From 9e685a82b3f066ac19caf2ad3648e310209fe9e6 Mon Sep 17 00:00:00 2001 From: qiuguohua Date: Fri, 20 Dec 2024 17:42:55 +0800 Subject: [PATCH] Fix JS exception causing application crash --- native/cocos/bindings/jswrapper/jsvm/CommonHeader.h | 3 +-- native/cocos/bindings/jswrapper/jsvm/Object.cpp | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/native/cocos/bindings/jswrapper/jsvm/CommonHeader.h b/native/cocos/bindings/jswrapper/jsvm/CommonHeader.h index a4905147394..a235f5154af 100644 --- a/native/cocos/bindings/jswrapper/jsvm/CommonHeader.h +++ b/native/cocos/bindings/jswrapper/jsvm/CommonHeader.h @@ -67,8 +67,7 @@ SE_LOGE("JSVM error message: %s", messagestr); \ } \ } \ - } \ - NODE_API_CALL_BASE(env, status, nullptr) + } // Returns empty if the_call doesn't return JSVM_OK. #define NODE_API_CALL_RETURN_VOID(env, the_call) \ diff --git a/native/cocos/bindings/jswrapper/jsvm/Object.cpp b/native/cocos/bindings/jswrapper/jsvm/Object.cpp index b12ffb5ce9a..7ecc8bb9775 100644 --- a/native/cocos/bindings/jswrapper/jsvm/Object.cpp +++ b/native/cocos/bindings/jswrapper/jsvm/Object.cpp @@ -383,6 +383,7 @@ Object* Object::createTypedArrayWithBuffer(TypedArrayType type, const Object *ob case TypedArrayType::INT16: jsvmType = JSVM_INT8_ARRAY; sizeOfEle = 2; + break; case TypedArrayType::UINT16: jsvmType = JSVM_UINT8_ARRAY; sizeOfEle = 2; @@ -390,9 +391,11 @@ Object* Object::createTypedArrayWithBuffer(TypedArrayType type, const Object *ob case TypedArrayType::INT32: jsvmType = JSVM_INT32_ARRAY; sizeOfEle = 4; + break; case TypedArrayType::UINT32: jsvmType = JSVM_UINT32_ARRAY; sizeOfEle = 4; + break; case TypedArrayType::FLOAT32: jsvmType = JSVM_FLOAT32_ARRAY; sizeOfEle = 4;