From 6664a089d823dfcefd47021e6b47dab72785003e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 6 Mar 2024 13:33:27 -0800 Subject: [PATCH] Add missing null check for displaydata during window creation Found in the wild from minidump reports. Unclear displaydata is null, but according to the API it is possible for this call to return null so it seems like a valid check. --- src/video/x11/SDL_x11window.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 7fa3d3fe7f..667a7c6c20 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -446,6 +446,10 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI SDL_VideoData *data = _this->driverdata; SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window); + if (!displaydata) { + return SDL_SetError("Could not find display info"); + } + const SDL_bool force_override_redirect = SDL_GetHintBoolean(SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT, SDL_FALSE); SDL_WindowData *windowdata; Display *display = data->display;