1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[quickjs] Check NULL in appendChild

This commit is contained in:
Witold Filipczyk 2024-09-17 12:42:12 +02:00
parent 33a3668f41
commit b55792f3ed
3 changed files with 18 additions and 6 deletions

View File

@ -2613,14 +2613,18 @@ js_element_appendChild(JSContext *ctx, JSValueConst this_val, int argc, JSValueC
dom_exception exc;
if (argc != 1) {
return JS_NULL;
return JS_EXCEPTION;
}
if (!el) {
return JS_EXCEPTION;
}
//dom_node_ref(el);
dom_node *el2 = (dom_node *)js_getopaque_any(argv[0]);
dom_node *el2 = NULL;
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)js_getopaque_any(argv[0]);
}
if (!el2) {
//dom_node_unref(el);

View File

@ -1014,14 +1014,18 @@ js_fragment_appendChild(JSContext *ctx, JSValueConst this_val, int argc, JSValue
dom_exception exc;
if (argc != 1) {
return JS_NULL;
return JS_EXCEPTION;
}
if (!el) {
return JS_EXCEPTION;
}
//dom_node_ref(el);
dom_node *el2 = (dom_node *)(js_getopaque_fragment(argv[0], js_fragment_class_id));
dom_node *el2 = NULL;
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)(js_getopaque_fragment(argv[0], js_fragment_class_id));
}
if (!el2) {
//dom_node_unref(el);

View File

@ -1048,14 +1048,18 @@ js_text_appendChild(JSContext *ctx, JSValueConst this_val, int argc, JSValueCons
dom_exception exc;
if (argc != 1) {
return JS_NULL;
return JS_EXCEPTION;
}
if (!el) {
return JS_EXCEPTION;
}
//dom_node_ref(el);
dom_node *el2 = (dom_node *)(js_getopaque_text(argv[0], js_text_class_id));
dom_node *el2 = NULL;
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)(js_getopaque_text(argv[0], js_text_class_id));
}
if (!el2) {
//dom_node_unref(el);