pidgin: c07ebf20: Add NULL checking to purple_markup_linki...

datallah at pidgin.im datallah at pidgin.im
Wed Aug 6 21:10:55 EDT 2008


-----------------------------------------------------------------
Revision: c07ebf2073bbd51862e773cab582fc75e97f3617
Ancestor: df81a5c6ac91279fb60751dad77cc72cbbae71cb
Author: datallah at pidgin.im
Date: 2008-08-07T01:08:37
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c07ebf2073bbd51862e773cab582fc75e97f3617

Modified files:
        libpurple/protocols/sametime/sametime.c libpurple/util.c

ChangeLog: 

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

-------------- next part --------------
============================================================
--- libpurple/protocols/sametime/sametime.c	22b95e00a68e8627214502a791f28f4d49858366
+++ libpurple/protocols/sametime/sametime.c	f57a2836e3579dc767727265d04760f695730200
@@ -1816,7 +1816,7 @@ static void mw_session_announce(struct m
   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);
 }
============================================================
--- libpurple/util.c	a3168300e653eb6e2c4e8106658db346ad27e36b
+++ libpurple/util.c	d2862b544833aff0243e38c2c411766d156516ba
@@ -2031,9 +2031,13 @@ purple_markup_linkify(const char *text)
 	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) {
 


More information about the Commits mailing list