From 35d5a83e3cc5542f45ceeaf663ed79dc6011fc66 Mon Sep 17 00:00:00 2001 From: songcongyi Date: Mon, 27 Sep 2021 14:22:55 +0800 Subject: [PATCH 1/2] fix codex problem Change-Id: Id017fbe260d935d2a031e42897622bdd4b4c0536 --- native_engine/impl/quickjs/quickjs_native_engine.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/native_engine/impl/quickjs/quickjs_native_engine.cpp b/native_engine/impl/quickjs/quickjs_native_engine.cpp index 56adf9d95..b14263ffa 100644 --- a/native_engine/impl/quickjs/quickjs_native_engine.cpp +++ b/native_engine/impl/quickjs/quickjs_native_engine.cpp @@ -606,8 +606,18 @@ NativeValue* QuickJSNativeEngine::JSValueToNativeValue(QuickJSNativeEngine* engi void* QuickJSNativeEngine::CreateRuntime() { JSRuntime* runtime = JS_NewRuntime(); + if (runtime == nullptr) { + return nullptr; + } JSContext* context = JS_NewContext(runtime); - return reinterpret_cast(new QuickJSNativeEngine(runtime, context, this)); + if (context == nullptr) { + return nullptr; + } + QuickJSNativeEngine* qjsEngine = new QuickJSNativeEngine(runtime, context, this); + if (qjsEngine == nullptr) { + return nullptr; + } + return reinterpret_cast(qjsEngine); } bool QuickJSNativeEngine::CheckTransferList(JSValue transferList) -- Gitee From 51a1ea4f956a7261b56503f02154d475ad03594f Mon Sep 17 00:00:00 2001 From: songcongyi Date: Mon, 27 Sep 2021 21:31:55 +0800 Subject: [PATCH 2/2] fix codex problem Change-Id: If92ddaa690ab261e2ebc36ed61482a168051d224 --- native_engine/impl/quickjs/quickjs_native_engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native_engine/impl/quickjs/quickjs_native_engine.cpp b/native_engine/impl/quickjs/quickjs_native_engine.cpp index b14263ffa..1f212ad7f 100644 --- a/native_engine/impl/quickjs/quickjs_native_engine.cpp +++ b/native_engine/impl/quickjs/quickjs_native_engine.cpp @@ -617,7 +617,7 @@ void* QuickJSNativeEngine::CreateRuntime() if (qjsEngine == nullptr) { return nullptr; } - return reinterpret_cast(qjsEngine); + return qjsEngine; } bool QuickJSNativeEngine::CheckTransferList(JSValue transferList) -- Gitee