changeset 15808:b0d74443fa2a

Protection against missing SHA1C
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 17 Mar 2007 17:38:12 +0000
parents 887ed73d426c
children d704829a07b2
files libpurple/protocols/msn/object.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/object.c	Sat Mar 17 17:34:32 2007 +0000
+++ b/libpurple/protocols/msn/object.c	Sat Mar 17 17:38:12 2007 +0000
@@ -125,19 +125,24 @@
 msn_object_to_string(const MsnObject *obj)
 {
 	char *str;
+	const char *sha1c;
 
 	g_return_val_if_fail(obj != NULL, NULL);
 
+	sha1c = msn_object_get_sha1c(obj);
+
 	str = g_strdup_printf("<msnobj Creator=\"%s\" Size=\"%d\" Type=\"%d\" "
-						  "Location=\"%s\" Friendly=\"%s\" SHA1D=\"%s\" "
-						  "SHA1C=\"%s\"/>",
+						  "Location=\"%s\" Friendly=\"%s\" SHA1D=\"%s\""
+						  "%s%s%s/>",
 						  msn_object_get_creator(obj),
 						  msn_object_get_size(obj),
 						  msn_object_get_type(obj),
 						  msn_object_get_location(obj),
 						  msn_object_get_friendly(obj),
 						  msn_object_get_sha1d(obj),
-						  msn_object_get_sha1c(obj));
+						  sha1c ? " SHA1C=\"" : "",
+						  sha1c ? sha1c : "",
+						  sha1c ? "\"" : "");
 
 	return str;
 }