mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
add script engine initialize check when evalString from native
This commit is contained in:
@@ -47,6 +47,11 @@ extern "C" {
|
||||
JNIEXPORT jint JNICALL JNI_JSJAVABRIDGE(evalString)
|
||||
(JNIEnv *env, jclass cls, jstring value)
|
||||
{
|
||||
if (!se::ScriptEngine::getInstance()->isValid()) {
|
||||
CCLOG("ScriptEngine has not been initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
se::AutoHandleScope hs;
|
||||
bool strFlag = false;
|
||||
std::string strValue = cocos2d::StringUtils::getStringUTFCharsJNI(env, value, &strFlag);
|
||||
|
||||
Reference in New Issue
Block a user