[evolution-data-server/gnome-2-32] Avoid passing NULL to g_strstrip in e_contact_get calls (part ][)
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-32] Avoid passing NULL to g_strstrip in e_contact_get calls (part ][)
- Date: Mon, 4 Oct 2010 13:51:58 +0000 (UTC)
commit 60da54f6e6b7e9d65111d90842b0e787c5bc28f7
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 4 15:51:30 2010 +0200
Avoid passing NULL to g_strstrip in e_contact_get calls (part ][)
addressbook/libebook/e-contact.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index d3a74b2..d1c53c8 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -1437,7 +1437,7 @@ e_contact_get (EContact *contact, EContactField field_id)
v = e_vcard_attribute_get_values (attr);
v = g_list_nth (v, info->list_elem);
- return v ? g_strstrip (g_strdup (v->data)) : NULL;
+ return (v && v->data) ? g_strstrip (g_strdup (v->data)) : NULL;
}
}
}
@@ -1458,7 +1458,7 @@ e_contact_get (EContact *contact, EContactField field_id)
if (num_left-- == 0) {
GList *v = e_vcard_attribute_get_values (attr);
- return v ? g_strstrip (g_strdup (v->data)) : NULL;
+ return (v && v->data) ? g_strstrip (g_strdup (v->data)) : NULL;
}
}
}
@@ -1470,7 +1470,7 @@ e_contact_get (EContact *contact, EContactField field_id)
if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
if (attr) {
GList *p = e_vcard_attribute_get_values (attr);
- return g_strstrip (g_strdup (p->data));
+ return (p && p->data) ? g_strstrip (g_strdup (p->data)) : NULL;
}
else {
return NULL;
@@ -1561,10 +1561,10 @@ e_contact_get (EContact *contact, EContactField field_id)
v = e_vcard_attribute_get_values (attr);
if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
- return v ? g_strstrip (g_strdup (v->data)) : NULL;
+ return (v && v->data) ? g_strstrip (g_strdup (v->data)) : NULL;
}
else {
- rv = g_list_append (rv, v ? g_strstrip (g_strdup (v->data)) : NULL);
+ rv = g_list_append (rv, (v && v->data) ? g_strstrip (g_strdup (v->data)) : NULL);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]