1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

[quickjs] Check NULL in isEqualNode

This commit is contained in:
Witold Filipczyk 2024-09-17 16:46:52 +02:00
parent 894a37ec65
commit f96132d7ce
3 changed files with 27 additions and 9 deletions

View File

@ -3347,12 +3347,18 @@ js_element_isEqualNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueC
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
if (!el) {
return JS_FALSE;
return JS_EXCEPTION;
}
dom_node *el2 = NULL;
//dom_node_ref(el);
JSValue node = argv[0];
dom_node *el2 = (dom_node *)(js_getopaque(node, js_element_class_id));
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)(js_getopaque(argv[0], js_element_class_id));
}
if (!el2) {
return JS_EXCEPTION;
}
struct string first;
struct string second;

View File

@ -1285,12 +1285,18 @@ js_fragment_isEqualNode(JSContext *ctx, JSValueConst this_val, int argc, JSValue
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);
dom_node *el2 = NULL;
JSValue node = argv[0];
dom_node *el2 = (dom_node *)(js_getopaque_fragment(node, js_fragment_class_id));
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)(js_getopaque_fragment(argv[0], js_fragment_class_id));
}
if (!el2) {
return JS_EXCEPTION;
}
struct string first;
struct string second;

View File

@ -1318,12 +1318,18 @@ js_text_isEqualNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueCons
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);
dom_node *el2 = NULL;
JSValue node = argv[0];
dom_node *el2 = (dom_node *)(js_getopaque_text(node, js_text_class_id));
if (!JS_IsNull(argv[0])) {
el2 = (dom_node *)(js_getopaque_text(argv[0], js_text_class_id));
}
if (!el2) {
return JS_EXCEPTION;
}
struct string first;
struct string second;