From: John-Mark Bell Date: Mon, 31 Dec 2012 00:10:38 +0000 (+0000) Subject: Handle empty text nodes correctly. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=f30bcdde419565d50974a288c816aad30a412683;p=libsvgtiny.git Handle empty text nodes correctly. --- diff --git a/src/svgtiny.c b/src/svgtiny.c index 403758b..0bcfe7d 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -1008,9 +1008,13 @@ svgtiny_code svgtiny_parse_text(dom_element *text, dom_node_unref(child); return svgtiny_LIBDOM_ERROR; } - shape->text = strndup(dom_string_data(content), - dom_string_byte_length(content)); - dom_string_unref(content); + if (content != NULL) { + shape->text = strndup(dom_string_data(content), + dom_string_byte_length(content)); + dom_string_unref(content); + } else { + shape->text = strdup(""); + } shape->text_x = px; shape->text_y = py; state.diagram->shape_count++;