From 461c947d1238a1ca5604ec34bd4fe84e040334f7 Mon Sep 17 00:00:00 2001
From: Jonathan Beck <jonabeck@gmail.com>
Date: Sat, 14 Feb 2009 14:41:54 +0100
Subject: [PATCH] Only call g_base64_encode if there is data to encode.

---
 src/xplist.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/xplist.c b/src/xplist.c
index b404e79..e985243 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -190,9 +190,11 @@ static void node_to_xml(GNode * node, gpointer xml_struct)
 
 	case PLIST_DATA:
 		tag = XPLIST_DATA;
-		valtmp = g_base64_encode(node_data->buff, node_data->length);
-		val = format_string(valtmp, 60, xstruct->depth);
-		g_free(valtmp);
+		if (node_data->length) {
+			valtmp = g_base64_encode(node_data->buff, node_data->length);
+			val = format_string(valtmp, 60, xstruct->depth);
+			g_free(valtmp);
+		}
 		break;
 	case PLIST_ARRAY:
 		tag = XPLIST_ARRAY;
-- 
2.18.1