]> gitweb.michael.orlitzky.com - libsvgtiny.git/blobdiff - src/svgtiny.c
Handle empty text nodes correctly.
[libsvgtiny.git] / 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++;