sdl12-compat: macos: Whoops, we need to intialize NSApp before using it in SDLmain.

From 1277a3b529a0c32fda881eba225b69d50efa4bca Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 13 Dec 2021 22:51:35 -0500
Subject: [PATCH] macos: Whoops, we need to intialize NSApp before using it in
 SDLmain.

---
 src/SDLmain/macosx/SDLMain.m | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/SDLmain/macosx/SDLMain.m b/src/SDLmain/macosx/SDLMain.m
index 4c9f720..a899beb 100644
--- a/src/SDLmain/macosx/SDLMain.m
+++ b/src/SDLmain/macosx/SDLMain.m
@@ -186,6 +186,9 @@ static void CustomApplicationMain (int argc, char **argv)
     ProcessSerialNumber psn = { 0, kCurrentProcess};
     TransformProcessType(&psn, kProcessTransformToForegroundApplication);
 
+    /* Ensure the application object is initialised */
+    [NSApplication sharedApplication];
+
     /* Set up the menubar */
     [NSApp setMainMenu:[[NSMenu alloc] init]];
     setApplicationMenu();