Merge pull request #1743 from wuzhiming/v2.0.10-release

add script engine initialize check when evalString from native
This commit is contained in:
吴智明
2019-05-22 10:45:50 +08:00
committed by GitHub
@@ -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);