]> git.0d.be Git - empathy.git/commitdiff
empathy_add_link_markup() is not NULL-safe
authorXavier Claessens <xclaesse@gmail.com>
Thu, 4 Mar 2010 17:11:26 +0000 (18:11 +0100)
committerXavier Claessens <xclaesse@gmail.com>
Thu, 4 Mar 2010 17:14:55 +0000 (18:14 +0100)
Add a g_return_val_if_fail() to avoid crash, and avoid calling that func
with NULL text.

libempathy-gtk/empathy-contact-widget.c
libempathy-gtk/empathy-string-parser.c

index 75f244698357322f3d60dc83f6bb6995623e6ce1..696a8cda4f62d7a790ceffb4b374f05dceb20201 100644 (file)
@@ -950,10 +950,11 @@ static void
 contact_widget_presence_notify_cb (EmpathyContactWidget *information)
 {
   const gchar *status;
-  gchar *markup_text;
+  gchar *markup_text = NULL;
 
   status = empathy_contact_get_status (information->contact);
-  markup_text = empathy_add_link_markup (status);
+  if (status != NULL)
+    markup_text = empathy_add_link_markup (status);
   gtk_label_set_markup (GTK_LABEL (information->label_status), markup_text);
   g_free (markup_text);
 
index fa56a2d4270f8417a6f8739f266d0820097f2395..5c3fb197294771af86ae8b34351c8791876577a5 100644 (file)
@@ -201,6 +201,8 @@ empathy_add_link_markup (const gchar *text)
        };
        GString *string;
 
+       g_return_val_if_fail (text != NULL, NULL);
+
        string = g_string_sized_new (strlen (text));
        empathy_string_parser_substr (text, -1, parsers, string);