From eeae48464e1240462b6839ab932c4b19e64be8bd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 13 Aug 2025 19:42:28 -0700 Subject: [PATCH] Fixed crash if X11 initialization fails --- src/video/x11/SDL_x11mouse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 6cfe1c0501..8b468675f6 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -536,8 +536,10 @@ void X11_QuitMouse(SDL_VideoDevice *_this) int j; for (j = 0; j < SDL_arraysize(sys_cursors); j++) { - X11_FreeCursor(sys_cursors[j]); - sys_cursors[j] = NULL; + if (sys_cursors[j]) { + X11_FreeCursor(sys_cursors[j]); + sys_cursors[j] = NULL; + } } for (i = data->mouse_device_info; i; i = next) {