[evolution-data-server] Avoid passing NULL to g_strstrip in e_contact_get calls
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Avoid passing NULL to g_strstrip in e_contact_get calls
- Date: Fri, 30 Apr 2010 11:46:57 +0000 (UTC)
commit 1c7a9179b45d3b45e9cdbb0dcee04dac9fbddeef
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 30 13:46:12 2010 +0200
Avoid passing NULL to g_strstrip in e_contact_get calls
addressbook/libebook/e-contact.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index f444416..96ff552 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -1423,7 +1423,7 @@ e_contact_get (EContact *contact, EContactField field_id)
GList *list = g_list_copy (e_vcard_attribute_get_values (attr));
GList *l;
for (l = list; l; l = l->next)
- l->data = g_strstrip (g_strdup (l->data));
+ l->data = l->data ? g_strstrip (g_strdup (l->data)) : NULL;
return list;
}
}
@@ -1495,6 +1495,8 @@ e_contact_get (EContact *contact, EContactField field_id)
if (info->t & E_CONTACT_FIELD_TYPE_STRUCT)
return (gpointer)info->boxed_type_getter();
+ else if (!rv)
+ return NULL;
else
return g_strstrip (g_strdup (rv));
}
@@ -1517,7 +1519,7 @@ e_contact_get (EContact *contact, EContactField field_id)
str = e_contact_get_const (contact, E_CONTACT_EMAIL_1);
}
- return g_strstrip (g_strdup (str));
+ return str ? g_strstrip (g_strdup (str)) : NULL;
}
case E_CONTACT_CATEGORIES: {
EVCardAttribute *attr = e_contact_get_first_attr (contact, EVC_CATEGORIES);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]