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

[quickjs] Check for NULL in isSameNode

This commit is contained in:
Witold Filipczyk 2024-09-17 17:02:53 +02:00
parent cdd19697d3
commit 033d521cac
3 changed files with 18 additions and 9 deletions

View File

@ -3402,11 +3402,14 @@ js_element_isSameNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueCo
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
if (!el) {
return JS_FALSE;
return JS_EXCEPTION;
}
//dom_node_ref(el);
JSValue node = argv[0];
dom_node *el2 = (dom_node *)(js_getopaque(node, js_element_class_id));
dom_node *el2 = NULL;
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)(js_getopaque(argv[0], js_element_class_id));
}
bool res = (el == el2);
//dom_node_unref(el);

View File

@ -1340,11 +1340,14 @@ js_fragment_isSameNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueC
dom_node *el = (dom_node *)(js_getopaque_fragment(this_val, js_fragment_class_id));
if (!el) {
return JS_FALSE;
return JS_EXCEPTION;
}
//dom_node_ref(el);
JSValue node = argv[0];
dom_node *el2 = (dom_node *)(js_getopaque_fragment(node, 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));
}
bool res = (el == el2);
//dom_node_unref(el);

View File

@ -1373,11 +1373,14 @@ js_text_isSameNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst
dom_node *el = (dom_node *)(js_getopaque_text(this_val, js_text_class_id));
if (!el) {
return JS_FALSE;
return JS_EXCEPTION;
}
//dom_node_ref(el);
JSValue node = argv[0];
dom_node *el2 = (dom_node *)(js_getopaque_text(node, 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));
}
bool res = (el == el2);
//dom_node_unref(el);