changeset 23709:27eacd38c721

Add NULL checking to purple_markup_linkify(). Display meanwhile announcements that don't have message text associated (I'm not sure if this is right, the current code doesn't allow for that scenario). Fixes #6518
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 07 Aug 2008 01:08:37 +0000
parents ccc0dd1db9ae
children 6f47135f5378
files libpurple/protocols/sametime/sametime.c libpurple/util.c
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/sametime/sametime.c	Wed Aug 06 15:50:04 2008 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Thu Aug 07 01:08:37 2008 +0000
@@ -1816,7 +1816,7 @@
   who = g_strdup_printf(_("Announcement from %s"), who);
   msg = purple_markup_linkify(text);
 
-  purple_conversation_write(conv, who, msg, PURPLE_MESSAGE_RECV, time(NULL));
+  purple_conversation_write(conv, who, msg ? msg : "", PURPLE_MESSAGE_RECV, time(NULL));
   g_free(who);
   g_free(msg);
 }
--- a/libpurple/util.c	Wed Aug 06 15:50:04 2008 +0000
+++ b/libpurple/util.c	Thu Aug 07 01:08:37 2008 +0000
@@ -2031,8 +2031,12 @@
 	gunichar g;
 	gboolean inside_html = FALSE;
 	int inside_paren = 0;
-	GString *ret = g_string_new("");
-	/* Assumes you have a buffer able to carry at least BUF_LEN * 2 bytes */
+	GString *ret;
+
+	if (text == NULL)
+		return NULL;
+
+	ret = g_string_new("");
 
 	c = text;
 	while (*c) {