# HG changeset patch # User Will Thompson # Date 1208022496 0 # Node ID 0c59913dc8a0738e148affaa7c896ffe31413c19 # Parent 487105d73907fe4c08ce4c94c170d8b6b7d393eb Modified version of a patch from "dseven" to prevent crashing on NULL topics with prehistoric Gtk. Fixes #5205. Thanks! diff -r 487105d73907 -r 0c59913dc8a0 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sat Apr 12 17:35:19 2008 +0000 +++ b/pidgin/gtkconv.c Sat Apr 12 17:48:16 2008 +0000 @@ -6538,7 +6538,9 @@ markup = title; } } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - const char *topic = gtkconv->u.chat->topic_text ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)) : NULL; + const char *topic = gtkconv->u.chat->topic_text + ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)) + : NULL; char *esc = NULL, *tmp; #if GTK_CHECK_VERSION(2,6,0) esc = topic ? g_markup_escape_text(topic, -1) : NULL; @@ -6548,20 +6550,22 @@ int len = 0; char *c; - tmp = g_strdup(topic); - c = tmp; - while(*c && len < 72) { - c = g_utf8_next_char(c); - len++; + if (topic != NULL) { + tmp = g_strdup(topic); + c = tmp; + while(*c && len < 72) { + c = g_utf8_next_char(c); + len++; + } + if (len == 72) { + *c = '\0'; + c = g_strdup_printf("%s...", tmp); + g_free(tmp); + tmp = c; + } + esc = g_markup_escape_text(tmp, -1); + g_free(tmp); } - if (len == 72) { - *c = '\0'; - c = g_strdup_printf("%s...", tmp); - g_free(tmp); - tmp = c; - } - esc = tmp ? g_markup_escape_text(tmp, -1) : NULL; - g_free(tmp); #endif tmp = g_markup_escape_text(purple_conversation_get_title(conv), -1); markup = g_strdup_printf("%s%s%s",