Commit 5d66429cc36eb8f2f214ede5abbbde6593644644

Sam Lantinga 2023-10-23T08:27:24

Add missing error reporting in Android_JNI_FileOpen() Fixes https://github.com/libsdl-org/SDL/issues/8427 (cherry picked from commit a844d909426153985136433f28ee5621affce97e) (cherry picked from commit 259009a7ea3a8ec05d0e8f59b7909bb234e00f85)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index 34dfded..0c8811c 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -1939,12 +1939,12 @@ int Android_JNI_FileOpen(SDL_RWops *ctx,
     }
 
     if (asset_manager == NULL) {
-        return -1;
+        return SDL_SetError("Couldn't create asset manager");
     }
 
     asset = AAssetManager_open(asset_manager, fileName, AASSET_MODE_UNKNOWN);
     if (asset == NULL) {
-        return -1;
+        return SDL_SetError("Couldn't open asset '%s'", fileName);
     }
 
     ctx->hidden.androidio.asset = (void *)asset;