Commit e04a0221e357c1b89bc11c284f06e7b31206cdfe

Sam Lantinga 2021-11-27T09:36:44

Fixed crash running SDL test programs on UWP

diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index 4ed6f36..929d1d3 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -357,9 +357,16 @@ void SDL_WinRTApp::Run()
     {
         // TODO, WinRT: pass the C-style main() a reasonably realistic
         // representation of command line arguments.
-        int argc = 0;
-        char **argv = NULL;
+        int argc = 1;
+        char **argv = (char **)SDL_malloc(2 * sizeof(*argv));
+        if (!argv) {
+            return;
+        }
+        argv[0] = SDL_strdup("WinRTApp");
+        argv[1] = NULL;
         WINRT_SDLAppEntryPoint(argc, argv);
+        SDL_free(argv[0]);
+        SDL_free(argv);
     }
 }