Ignore empty currentmedia string. cpw.khc.msnp14

Sat, 15 Sep 2007 23:53:15 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Sat, 15 Sep 2007 23:53:15 +0000
branch
cpw.khc.msnp14
changeset 20590
633c12c90fd7
parent 20589
312d830f7169
child 20591
8469ac3acbec

Ignore empty currentmedia string.

libpurple/protocols/msn/state.c file | annotate | diff | comparison | revisions
--- 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 */

mercurial