[evolution-data-server/gnome-3-2] Bug #652173 - EContact's file-as getter doesn't populate empty value



commit d072dd312f50e3d3444bc14977f0cd2b022f9667
Author: Milan Crha <mcrha redhat com>
Date:   Tue Dec 13 13:09:35 2011 +0100

    Bug #652173 - EContact's file-as getter doesn't populate empty value

 addressbook/libebook/e-contact.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index b9fdf41..f938dd8 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -566,7 +566,15 @@ static gpointer
 fileas_getter (EContact *contact,
                EVCardAttribute *attr)
 {
-	if (!attr) {
+	GList *p = NULL;
+
+	if (attr) {
+		p = e_vcard_attribute_get_values (attr);
+		if (!p || !p->data || !*((const gchar *) p->data))
+			p = NULL;
+	}
+
+	if (!p) {
 		/* Generate a FILE_AS field */
 		EContactName *name;
 		gchar *new_file_as = NULL;
@@ -609,7 +617,7 @@ fileas_getter (EContact *contact,
 	}
 
 	if (attr) {
-		GList *p = e_vcard_attribute_get_values (attr);
+		p = e_vcard_attribute_get_values (attr);
 
 		return p && p->data ? p->data : (gpointer) "";
 	} else {



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