SDL: Fixed crash if video isn't initialized in SDL_CreatePopupWindow()

From 06d59891576937b4c2e8f4cb1587ece7a83bd87f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 23 May 2023 13:41:34 -0700
Subject: [PATCH] Fixed crash if video isn't initialized in
 SDL_CreatePopupWindow()

---
 src/video/SDL_video.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 753dd485ea30..aedec49df3f3 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1996,6 +1996,11 @@ SDL_Window *SDL_CreateWindowWithPosition(const char *title, int x, int y, int w,
 
 SDL_Window *SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y, int w, int h, Uint32 flags)
 {
+    if (_this == NULL) {
+        SDL_UninitializedVideo();
+        return NULL;
+    }
+
     if (!(_this->quirk_flags & VIDEO_DEVICE_QUIRK_HAS_POPUP_WINDOW_SUPPORT)) {
         SDL_Unsupported();
         return NULL;