From 960cee2703cd4650f2805d4fb35da6e372f49bd1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sun, 17 Mar 2024 15:29:15 -0400
Subject: [PATCH] Do not attempt to clean up SDL unless it was initialized.

Should fix js test suite on darwin.
---
 src/conio/sdl_con.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c
index 9a2f1e663a..9f0046d6a4 100644
--- a/src/conio/sdl_con.c
+++ b/src/conio/sdl_con.c
@@ -294,7 +294,8 @@ void exit_sdl_con(void)
 {
 	// Avoid calling exit(0) from an atexit() function...
 	ciolib_reaper = 0;
-	sdl_user_func_ret(SDL_USEREVENT_QUIT);
+	if (sdl_init_good)
+		sdl_user_func_ret(SDL_USEREVENT_QUIT);
 }
 
 void sdl_copytext(const char *text, size_t buflen)
-- 
GitLab