Merge pull request #3768 from michaelcontento/android-fix-null-access

[ci skip]wrong variable used which could crash the whole app
This commit is contained in:
minggo 2013-09-23 19:07:22 -07:00
commit 5f2c94ee3c
1 changed files with 3 additions and 3 deletions

View File

@ -254,13 +254,13 @@ namespace cocos2d {
} }
JNIEnv *pEnv = JniHelper::getEnv(); JNIEnv *pEnv = JniHelper::getEnv();
if (!env) { if (!pEnv) {
return NULL; return NULL;
} }
const char* chars = env->GetStringUTFChars(jstr, NULL); const char* chars = pEnv->GetStringUTFChars(jstr, NULL);
std::string ret(chars); std::string ret(chars);
env->ReleaseStringUTFChars(jstr, chars); pEnv->ReleaseStringUTFChars(jstr, chars);
return ret; return ret;
} }