summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorsanikoyes <sanikoyes@163.com>2016-07-11 12:41:54 +0800
committersanikoyes <sanikoyes@163.com>2016-07-11 12:41:54 +0800
commit978cb0e884dea9be4d98a0b52ae930655f7d9ad8 (patch)
tree04c717c2136d63064eef478b425ff6f15ff15d2d /platform/android
parent9397458cc0a37f4899a0dba5352a6e045ed123d8 (diff)
Fix crash in FileAccessJAndroid::file_exists (does not free local ref)
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/file_access_jandroid.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index da8ceaff14..ea33e9a67b 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/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;