SDL: Fixed infinite recursion at startup on Android

From 095fb5f5221f18294a60c78dd859c9b59e5ed8f5 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 20 Sep 2024 10:55:31 -0700
Subject: [PATCH] Fixed infinite recursion at startup on Android

---
 src/stdlib/SDL_getenv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c
index 6b691e3df1513..a02112bd71b6a 100644
--- a/src/stdlib/SDL_getenv.c
+++ b/src/stdlib/SDL_getenv.c
@@ -122,7 +122,12 @@ SDL_Environment *SDL_CreateEnvironment(bool populated)
 #else
 #ifdef SDL_PLATFORM_ANDROID
         // Make sure variables from the application manifest are available
-        Android_JNI_GetManifestEnvironmentVariables();
+        static bool initializing;
+        if (!initializing) {
+            initializing = true;
+            Android_JNI_GetManifestEnvironmentVariables();
+            initializing = false;
+        }
 #endif
         char **strings = environ;
         if (strings) {