[empathy] empathy_add_link_markup() is not NULL-safe
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] empathy_add_link_markup() is not NULL-safe
- Date: Thu, 4 Mar 2010 17:15:04 +0000 (UTC)
commit ba5b7807abcbd86cc9d35440754b68a3fe970f18
Author: Xavier Claessens <xclaesse gmail com>
Date: Thu Mar 4 18:11:26 2010 +0100
empathy_add_link_markup() is not NULL-safe
Add a g_return_val_if_fail() to avoid crash, and avoid calling that func
with NULL text.
libempathy-gtk/empathy-contact-widget.c | 5 +++--
libempathy-gtk/empathy-string-parser.c | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 75f2446..696a8cd 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -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);
diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c
index fa56a2d..5c3fb19 100644
--- a/libempathy-gtk/empathy-string-parser.c
+++ b/libempathy-gtk/empathy-string-parser.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]