sms-list: handle NULL paths in SMS objects

They will have NULL paths when they are not exported yet
This commit is contained in:
Aleksander Morgado
2012-03-15 14:15:01 +01:00
parent 672e9d09e3
commit 9fd2c3a1dc
+9 -3
View File
@@ -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