Browse Source

Fix crash in FileAccessJAndroid::file_exists (does not free local ref)

sanikoyes 9 years ago
parent
commit
978cb0e884
1 changed files with 3 additions and 1 deletions
  1. 3 1
      platform/android/file_access_jandroid.cpp

+ 3 - 1
platform/android/file_access_jandroid.cpp

@@ -182,8 +182,10 @@ bool FileAccessJAndroid::file_exists(const String& p_path) {
 
 	jstring js = env->NewStringUTF(path.utf8().get_data());
 	int res = env->CallIntMethod(io,_file_open,js,false);
-	if (res<=0)
+	if (res<=0) {
+		env->DeleteLocalRef(js);
 		return false;
+	}
 	env->CallVoidMethod(io,_file_close,res);
 	env->DeleteLocalRef(js);
 	return true;