add script engine initialize check when evalString from native

This commit is contained in:
wuzhiming
2019-05-20 11:03:03 +08:00
parent c8a00942a0
commit 7a19c65d52
@@ -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);