Ver código fonte

SDL_RunApp: Make sure argc/argv are stable if the caller didn't define them.

Fixes #8246.
Ryan C. Gordon 1 ano atrás
pai
commit
3264e64738
1 arquivos alterados com 3 adições e 4 exclusões
  1. 3 4
      src/core/SDL_runapp.c

+ 3 - 4
src/core/SDL_runapp.c

@@ -27,15 +27,14 @@
 DECLSPEC int
 SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
 {
-    char empty[1] = {0};
-    char* argvdummy[2] = { empty, NULL };
-
     (void)reserved;
 
     if(!argv)
     {
-        argc = 0;
         /* make sure argv isn't NULL, in case some user code doesn't like that */
+        static char dummyargv0[] = { 'S', 'D', 'L', '_', 'a', 'p', 'p', '\0' };
+        static char* argvdummy[2] = { dummyargv0, NULL };
+        argc = 1;
         argv = argvdummy;
     }