Skip to content
This repository was archived by the owner on Jul 8, 2026. It is now read-only.

Commit e9647df

Browse files
committed
fix: improve null value handling in object type check
- Updated the `isLikelyObject` function to use `napi_strict_equals` for null value comparison instead of `napi_is_null`, enhancing the accuracy of object type detection. - Introduced a new variable to hold the null value, improving code clarity and maintainability. These changes aim to ensure more reliable type checking within the property tree addon.
1 parent ee791ab commit e9647df

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

native/prop-tree-addon/prop-tree-addon.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ static bool isLikelyObject(napi_env env, napi_value v) {
1919
if (t != napi_object) return false;
2020

2121
// JS null is object per typeof check.
22+
napi_value nullVal = nullptr;
23+
napi_get_null(env, &nullVal);
2224
bool isNull = false;
23-
napi_is_null(env, v, &isNull);
25+
napi_strict_equals(env, v, nullVal, &isNull);
2426
if (isNull) return false;
2527

2628
return true;

0 commit comments

Comments
 (0)