skip verification of class ID in JS_GetOpaque if class_id is 0

This commit is contained in:
Ben Morris 2024-09-25 13:43:41 -04:00
parent 6e2e68fd08
commit 77b100d5e6

View file

@ -9847,7 +9847,7 @@ void *JS_GetOpaque(JSValueConst obj, JSClassID class_id)
if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)
return NULL;
p = JS_VALUE_GET_OBJ(obj);
if (p->class_id != class_id)
if (class_id && p->class_id != class_id)
return NULL;
return p->u.opaque;
}