From 6f87179c19a5f797aa21ad9033ae42c81c8ccc00 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sat, 20 Mar 2010 01:17:30 +0200 Subject: [PATCH] xml: added missing NULL check to sipe_xml_stringify() --- src/core/sipe-xml-tests.c | 3 +-- src/core/sipe-xml.c | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/sipe-xml-tests.c b/src/core/sipe-xml-tests.c index 19ba8d79..f4f4835d 100644 --- a/src/core/sipe-xml-tests.c +++ b/src/core/sipe-xml-tests.c @@ -30,8 +30,6 @@ #include -#include "xmlnode.h" - #include "sipe-common.h" #include "sipe-backend-debug.h" #include "sipe-xml.h" @@ -207,6 +205,7 @@ int main(SIPE_UNUSED_PARAMETER int argc, SIPE_UNUSED_PARAMETER char **argv) /* empty XML */ xml = assert_parse(NULL, FALSE); + assert_stringify(xml, NULL); sipe_xml_free(xml); xml = assert_parse("", FALSE); sipe_xml_free(xml); diff --git a/src/core/sipe-xml.c b/src/core/sipe-xml.c index 7300fee4..b798a69d 100644 --- a/src/core/sipe-xml.c +++ b/src/core/sipe-xml.c @@ -269,7 +269,11 @@ static void sipe_xml_stringify_node(GString *s, const sipe_xml *node) gchar *sipe_xml_stringify(const sipe_xml *node) { - GString *s = g_string_new(""); + GString *s; + + if (!node) return NULL; + + s = g_string_new(""); sipe_xml_stringify_node(s, node); return g_string_free(s, FALSE); } -- 2.11.4.GIT