]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
Handle empty text nodes correctly.
authorJohn-Mark Bell <jmb@netsurf-browser.org>
Mon, 31 Dec 2012 00:10:38 +0000 (00:10 +0000)
committerJohn-Mark Bell <jmb@netsurf-browser.org>
Mon, 31 Dec 2012 00:10:38 +0000 (00:10 +0000)
src/svgtiny.c

index 403758bba37c721d89555e8694107adc4bbe5718..0bcfe7daf94412c899f04b082062680553e67549 100644 (file)
@@ -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++;