aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-02-08 00:06:20 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:15:01 +0100
commit9fd2c3a1dcb03d85137357925fe56ffa7fbc9f84 (patch)
tree08e48fa34a2ab843ae1c0ecf8ab6c6732ea9c28a /src
parent672e9d09e366d02bffd5fcf1bca9e40c53a55416 (diff)
sms-list: handle NULL paths in SMS objects
They will have NULL paths when they are not exported yet
Diffstat (limited to 'src')
-rw-r--r--src/mm-sms-list.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mm-sms-list.c b/src/mm-sms-list.c
index a1e6eba6..2b4c24d6 100644
--- a/src/mm-sms-list.c
+++ b/src/mm-sms-list.c
@@ -71,8 +71,14 @@ mm_sms_list_get_paths (MMSmsList *self)
path_list = g_new0 (gchar *,
1 + g_list_length (self->priv->list));
- for (i = 0, l = self->priv->list; l; l = g_list_next (l))
- path_list[i++] = g_strdup (mm_sms_get_path (MM_SMS (l->data)));
+ for (i = 0, l = self->priv->list; l; l = g_list_next (l)) {
+ const gchar *path;
+
+ /* Don't try to add NULL paths (not yet exported SMS objects) */
+ path = mm_sms_get_path (MM_SMS (l->data));
+ if (path)
+ path_list[i++] = g_strdup (path);
+ }
return path_list;
}
@@ -115,7 +121,7 @@ static guint
cmp_sms_by_path (MMSms *sms,
const gchar *path)
{
- return strcmp (mm_sms_get_path (sms), path);
+ return g_strcmp0 (mm_sms_get_path (sms), path);
}
void