summaryrefslogtreecommitdiff
path: root/platform/android/file_access_jandroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/file_access_jandroid.cpp')
-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;