summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2012-12-31 00:10:38 (GMT)
committer John-Mark Bell <jmb@netsurf-browser.org>2012-12-31 00:10:38 (GMT)
commitf30bcdde419565d50974a288c816aad30a412683 (patch)
treef75dc0536d4c4ccb2bdf16baf9361bfb55a89506
parentc9f60cf51dd1c83a7b8b623cdfe61c0e1c95ccdf (diff)
downloadlibsvgtiny-f30bcdde419565d50974a288c816aad30a412683.tar.gz
libsvgtiny-f30bcdde419565d50974a288c816aad30a412683.tar.bz2
Handle empty text nodes correctly.
-rw-r--r--src/svgtiny.c10
1 files changed, 7 insertions, 3 deletions
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++;