From 0e4607fa9e19387e1dec67e7cdbf4f41a75a84f1 Mon Sep 17 00:00:00 2001 From: qiuguohua Date: Fri, 20 Dec 2024 18:17:11 +0800 Subject: [PATCH] Fix JS exception causing application crash (#18067) Co-authored-by: qiuguohua --- 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;