diff --git a/interfaces/inner_api/cjffi/ark_interop/ark_interop_bigint.cpp b/interfaces/inner_api/cjffi/ark_interop/ark_interop_bigint.cpp index cf8a58eb302ad4ec59af2d138d28310a0d946320..6dd6c9569e1a6522555038842045addda7ff41eb 100644 --- a/interfaces/inner_api/cjffi/ark_interop/ark_interop_bigint.cpp +++ b/interfaces/inner_api/cjffi/ark_interop/ark_interop_bigint.cpp @@ -81,6 +81,7 @@ ARKTS_Value ARKTS_CreateBigIntWithBytes(ARKTS_Env env, bool isNegative, int64_t bool ARKTS_IsBigInt(ARKTS_Env env, ARKTS_Value value) { ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto tag = BIT_CAST(value, panda::JSValueRef); if (!tag.IsHeapObject()) { return false; diff --git a/interfaces/inner_api/cjffi/ark_interop/ark_interop_napi.cpp b/interfaces/inner_api/cjffi/ark_interop/ark_interop_napi.cpp index 749b816773a7e68196c9c594dc1ede94adac70fb..cd46d8909194ff6f91a410076eddd82f67c05e5b 100644 --- a/interfaces/inner_api/cjffi/ark_interop/ark_interop_napi.cpp +++ b/interfaces/inner_api/cjffi/ark_interop/ark_interop_napi.cpp @@ -291,6 +291,8 @@ ARKTS_Value ARKTS_CreateFunc(ARKTS_Env env, int64_t lambdaId) bool ARKTS_IsClass(ARKTS_Env env, ARKTS_Value value) { + ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto tag = BIT_CAST(value, JSValueRef); if (!tag.IsHeapObject()) { return false; @@ -468,6 +470,7 @@ ARKTS_Value ARKTS_GetElement(ARKTS_Env env, ARKTS_Value array, uint32_t index) bool ARKTS_IsArray(ARKTS_Env env, ARKTS_Value value) { ARKTS_ASSERT_F(env, "env is NULL"); + ARKTS_ASSERT_F(value, "value is null"); auto v = BIT_CAST(value, JSValueRef); if (!v.IsHeapObject()) { return false; @@ -502,6 +505,7 @@ ARKTS_Value ARKTS_CreateArrayBufferWithData(ARKTS_Env env, void* buffer, int32_t bool ARKTS_IsArrayBuffer(ARKTS_Env env, ARKTS_Value value) { ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto tag = BIT_CAST(value, JSValueRef); if (!tag.IsHeapObject()) { return false; @@ -576,6 +580,7 @@ ARKTS_Value ARKTS_CreateExternal(ARKTS_Env env, void* data) bool ARKTS_IsExternal(ARKTS_Env env, ARKTS_Value value) { ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto prime = BIT_CAST(value, JSValueRef); if (!prime.IsHeapObject()) { return false; @@ -643,6 +648,7 @@ void ARKTS_PromiseCapabilityReject(ARKTS_Env env, ARKTS_Promise prom, ARKTS_Valu bool ARKTS_IsPromise(ARKTS_Env env, ARKTS_Value value) { ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto v = BIT_CAST(value, JSValueRef); if (!v.IsHeapObject()) { return false; diff --git a/interfaces/inner_api/cjffi/ark_interop/ark_interop_object.cpp b/interfaces/inner_api/cjffi/ark_interop/ark_interop_object.cpp index 50c3e9a10ad7622f1f58552a130f5f67d2be794d..db3ec185f5bfc897269ba3f655d8418af1abe8d3 100644 --- a/interfaces/inner_api/cjffi/ark_interop/ark_interop_object.cpp +++ b/interfaces/inner_api/cjffi/ark_interop/ark_interop_object.cpp @@ -46,6 +46,7 @@ ARKTS_Value ARKTS_CreateObject(ARKTS_Env env) bool ARKTS_IsHeapObject(ARKTS_Value value) { + ARKTS_ASSERT_F(value, "value is null"); auto v = BIT_CAST(value, JSValueRef); return v.IsHeapObject(); } @@ -53,6 +54,7 @@ bool ARKTS_IsHeapObject(ARKTS_Value value) bool ARKTS_IsObject(ARKTS_Env env, ARKTS_Value value) { ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto v = BIT_CAST(value, JSValueRef); if (!v.IsHeapObject()) { return false; diff --git a/interfaces/inner_api/cjffi/ark_interop/ark_interop_string.cpp b/interfaces/inner_api/cjffi/ark_interop/ark_interop_string.cpp index ed36898e72196027984facdefd46a8dde57cd629..ca23b53ef02a2135171e916083c4b792497542e6 100644 --- a/interfaces/inner_api/cjffi/ark_interop/ark_interop_string.cpp +++ b/interfaces/inner_api/cjffi/ark_interop/ark_interop_string.cpp @@ -44,6 +44,8 @@ ARKTS_Value ARKTS_CreateUtf8(ARKTS_Env env, const char* value, int32_t size) bool ARKTS_IsString(ARKTS_Env env, ARKTS_Value value) { + ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto v = BIT_CAST(value, JSValueRef); if (v.IsHole() || !v.IsHeapObject()) { return false; diff --git a/interfaces/inner_api/cjffi/ark_interop/ark_interop_symbol.cpp b/interfaces/inner_api/cjffi/ark_interop/ark_interop_symbol.cpp index 707581c37b93e57b54732c7f026e0f1aaff98438..5c65e8f2d1d4be989c6d15e933309f78d479599c 100644 --- a/interfaces/inner_api/cjffi/ark_interop/ark_interop_symbol.cpp +++ b/interfaces/inner_api/cjffi/ark_interop/ark_interop_symbol.cpp @@ -38,6 +38,8 @@ ARKTS_Value ARKTS_CreateSymbol(ARKTS_Env env, const char* description, int32_t l bool ARKTS_IsSymbol(ARKTS_Env env, ARKTS_Value value) { + ARKTS_ASSERT_F(env, "env is null"); + ARKTS_ASSERT_F(value, "value is null"); auto tag = BIT_CAST(value, JSValueRef); if (!tag.IsHeapObject()) { return false; @@ -49,7 +51,6 @@ bool ARKTS_IsSymbol(ARKTS_Env env, ARKTS_Value value) const char* ARKTS_GetSymbolDesc(ARKTS_Env env, ARKTS_Value value) { - ARKTS_ASSERT_P(env, "env is null"); ARKTS_ASSERT_P(ARKTS_IsSymbol(env, value), "value is not a symbol"); auto vm = P_CAST(env, EcmaVM*); diff --git a/test/unittest/cj_native/test_ark_interop.cpp b/test/unittest/cj_native/test_ark_interop.cpp index b1633eb15214744df909dc0dcf2cb3ac307e50e8..e3b971553f21bffd719381c38fa9d1f8eb4ed8d1 100644 --- a/test/unittest/cj_native/test_ark_interop.cpp +++ b/test/unittest/cj_native/test_ark_interop.cpp @@ -1436,7 +1436,7 @@ TEST_F(ArkInteropTest, GlobalRelease) TEST_F(ArkInteropTest, GlobalReleaseSync) { - MockContext local(ARKTS_CreateEngineWithNewThread()); + MockContext local; auto env = local.GetEnv(); int loops = 10; auto totalRepeat = 500000;