summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-07-12 07:26:53 +0200
committerGitHub <noreply@github.com>2016-07-12 07:26:53 +0200
commitf82e7d3a97431107b7581dc27f19912b12d3fb68 (patch)
treeecc267019584b5fc68732356384a3a40b51aea12
parent480ac2bcfbe114d402cf5279ba392e709d378a24 (diff)
parent978cb0e884dea9be4d98a0b52ae930655f7d9ad8 (diff)
Merge pull request #5641 from sanikoyes/Pr-fix-android-crash
Fix crash in FileAccessJAndroid::file_exists (does not free local ref)
-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;