diff pidgin/gtkconv.c @ 32659:3af16402f176

Add some NULL checks. Now it should not crash even if you don't have the default theme installed (which you won't since it's not even written yet!) You just won't see anything...
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 21 Sep 2011 07:01:58 +0000
parents 90264301600f
children 68fe7b5211a7
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Wed Sep 21 06:45:26 2011 +0000
+++ b/pidgin/gtkconv.c	Wed Sep 21 07:01:58 2011 +0000
@@ -5031,6 +5031,9 @@
 	char *path;
 
 	text = pidgin_conversation_theme_get_template(theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN);
+	if (text == NULL)
+		return NULL;
+
 	ms = g_strsplit(text, "%@", 6);
 	if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) {
 		g_strfreev(ms);
@@ -5977,10 +5980,14 @@
 	PurpleMessageFlags flags,
 	time_t mtime)
 {
-	GString *str = g_string_new(NULL);
+	GString *str;
 	const char *cur = text;
 	const char *prev = cur;
 
+	if (text == NULL)
+		return g_strdup("");
+
+	str = g_string_new(NULL);
 	while ((cur = strchr(cur, '%'))) {
 		const char *replace = NULL;
 		const char *fin = NULL;