changeset 20507:1553c95055e3

Ignore empty currentmedia string.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 15 Sep 2007 23:53:15 +0000
parents 42365ba802c0
children 34abe3faeaab
files libpurple/protocols/msn/state.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/state.c	Sat Sep 15 11:34:39 2007 +0000
+++ b/libpurple/protocols/msn/state.c	Sat Sep 15 23:53:15 2007 +0000
@@ -88,7 +88,7 @@
 {
 	char **cmedia_array;
 	char *inptr, *tmpptr;
-	GString *buffer;
+	GString *buffer = NULL;
 	int strings, tmp;
 
 	if ((cmedia == NULL) || (*cmedia == '\0')) {
@@ -103,9 +103,8 @@
 	strings = 0;
 	while (strcmp(cmedia_array[++strings], ""));   /* Yes, we want to skip the first empty string, apparently */
 
-	buffer = g_string_new(NULL);
-
 	if ((strings > 3) && (!strcmp(cmedia_array[2], "1"))) { /* Check if enabled */
+		buffer = g_string_new(NULL);
 		inptr = cmedia_array[3];
 
 #if 0
@@ -138,7 +137,7 @@
 	}
 
 	g_strfreev(cmedia_array);
-	return g_string_free(buffer, FALSE);
+	return buffer ? g_string_free(buffer, FALSE) : NULL;
 }
 
 /* get the CurrentMedia info from the XML string */