summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/box_construct.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index 5b22e9990..37fdede93 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -2867,9 +2867,12 @@ bool box_select_add_option(struct form_control *control, dom_node *n)
if (err != DOM_NO_ERR)
return false;
- text = squash_whitespace(dom_string_data(content));
-
- dom_string_unref(content);
+ if (content != NULL) {
+ text = squash_whitespace(dom_string_data(content));
+ dom_string_unref(content);
+ } else {
+ text = strdup("");
+ }
if (text == NULL)
goto no_memory;