summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2016-01-31 22:21:54 (GMT)
committer John-Mark Bell <jmb@netsurf-browser.org>2016-01-31 22:22:34 (GMT)
commitd81d30699f57f0ca41b917c854ef6d0875a18129 (patch)
tree2abb3ac6eb4984d8e0157216d0866b38763e3da3
parent5c2dc7300edb6449b29285818fde794ce2669f29 (diff)
downloadnsgenbind-d81d30699f57f0ca41b917c854ef6d0875a18129.tar.gz
nsgenbind-d81d30699f57f0ca41b917c854ef6d0875a18129.tar.bz2
Make generated string attribute getters cope with libdom returning NULL.
Fixes #2415, #2418.
-rw-r--r--src/duk-libdom-generated.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/duk-libdom-generated.c b/src/duk-libdom-generated.c
index e40c43e..bae0826 100644
--- a/src/duk-libdom-generated.c
+++ b/src/duk-libdom-generated.c
@@ -97,10 +97,14 @@ output_generated_attribute_getter(FILE* outf,
"\t\treturn 0;\n"
"\t}\n"
"\n"
- "\tduk_push_lstring(ctx,\n"
- "\t\tdom_string_data(str),\n"
- "\t\tdom_string_length(str));\n"
- "\tdom_string_unref(str);\n"
+ "\tif (str != NULL) {\n"
+ "\t\tduk_push_lstring(ctx,\n"
+ "\t\t\tdom_string_data(str),\n"
+ "\t\t\tdom_string_length(str));\n"
+ "\t\tdom_string_unref(str);\n"
+ "\t} else {\n"
+ "\t\tduk_push_lstring(ctx, NULL, 0);\n"
+ "\t}\n"
"\n"
"\treturn 1;\n");
break;