[folks] persona-store-cache: don't create empty field details



commit 2f1c60b5a3a60c8f1b80f690b88076c041ea3215
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue May 1 08:03:59 2012 +0200

    persona-store-cache: don't create empty field details
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675211

 .../telepathy/lib/tpf-persona-store-cache.vala     |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store-cache.vala b/backends/telepathy/lib/tpf-persona-store-cache.vala
index 792bef7..bd3321b 100644
--- a/backends/telepathy/lib/tpf-persona-store-cache.vala
+++ b/backends/telepathy/lib/tpf-persona-store-cache.vala
@@ -331,20 +331,31 @@ internal class Tpf.PersonaStoreCache : Folks.ObjectCache<Tpf.Persona>
 
       if (object_version == 2)
         {
+          /* Make sure that the extracted value is not empty as caches created
+           * before bgo#675144 was fixed may have stored empty values. */
           this.deserialise_abstract_field_details (variant.get_child_value (12),
               (v, p) =>
                 {
-                  email_address_set.add (new EmailFieldDetails (v, p));
+                  if (v != "")
+                    {
+                      email_address_set.add (new EmailFieldDetails (v, p));
+                    }
                 });
           this.deserialise_abstract_field_details (variant.get_child_value (13),
               (v, p) =>
                 {
-                  phone_number_set.add (new PhoneFieldDetails (v, p));
+                  if (v != "")
+                    {
+                      phone_number_set.add (new PhoneFieldDetails (v, p));
+                    }
                 });
           this.deserialise_abstract_field_details (variant.get_child_value (14),
               (v, p) =>
                 {
-                  url_set.add (new UrlFieldDetails (v, p));
+                  if (v != "")
+                    {
+                      url_set.add (new UrlFieldDetails (v, p));
+                    }
                 });
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]