changeset 1636:16c1ca141387

Fix bugzilla #8.
author William Pitcock <nenolod@atheme.org>
date Fri, 07 Sep 2007 05:20:51 -0500
parents 16044c4a34d7
children ed5d7f51ac38
files src/scrobbler/fmt.c src/scrobbler/scrobbler.c
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/scrobbler/fmt.c	Fri Sep 07 05:19:03 2007 -0500
+++ b/src/scrobbler/fmt.c	Fri Sep 07 05:20:51 2007 -0500
@@ -9,11 +9,17 @@
 
 char *fmt_escape(const char *str)
 {
+	if (str == NULL)
+		return "";
+
 	return curl_escape(str, 0);
 }
 
 char *fmt_unescape(char *str)
 {
+	if (str == NULL)
+		return "";
+
 	return curl_unescape(str, 0);
 }
 
--- a/src/scrobbler/scrobbler.c	Fri Sep 07 05:19:03 2007 -0500
+++ b/src/scrobbler/scrobbler.c	Fri Sep 07 05:20:51 2007 -0500
@@ -146,7 +146,7 @@
 		item->mb = fmt_escape((char*)tuple->mb);
 #endif
 
-	if((album = tuple_get_string(tuple, "album")))
+	if((album = tuple_get_string(tuple, "album")) != NULL)
 		item->album = fmt_escape("");
 	else
 		item->album = fmt_escape((char*) album);