android/specific: a missing Environment field is not critical
authorThomas Guillem <thomas@gllm.fr>
Mon, 18 Jul 2016 12:57:54 +0000 (14:57 +0200)
committerThomas Guillem <thomas@gllm.fr>
Mon, 18 Jul 2016 13:42:26 +0000 (15:42 +0200)
The DIRECTORY_DOCUMENTS field is not present before API 19. Not finding a field
is not critical (config_GetUserDir() will just return null for that field).

src/android/specific.c

index 1337157..cd064b7 100644 (file)
@@ -51,7 +51,10 @@ get_java_string(JNIEnv *env, jclass clazz, const char *psz_name)
     jfieldID id = (*env)->GetStaticFieldID(env, clazz, psz_name,
                                            "Ljava/lang/String;");
     if ((*env)->ExceptionCheck(env))
+    {
+        (*env)->ExceptionClear(env);
         return NULL;
+    }
 
     jstring jstr = (*env)->GetStaticObjectField(env, clazz, id);
 
@@ -113,12 +116,8 @@ JNI_OnLoad(JavaVM *vm, void *reserved)
     for (size_t i = 0; i < GENERIC_DIR_COUNT; ++i)
     {
         if (ppsz_env_names[i] != NULL)
-        {
             ppsz_generic_names[i] = get_java_string(env, clazz,
                                                    ppsz_env_names[i]);
-            if (!ppsz_generic_names[i])
-                goto error;
-        }
     }
 
     fields.Environment.clazz = (*env)->NewGlobalRef(env, clazz);