Fixed rare crash when creating an X11 window

This commit is contained in:
Sam Lantinga 2020-04-22 14:57:06 -07:00
parent d12ea89c1e
commit 589d636bb9
1 changed files with 9 additions and 1 deletions

View File

@ -1661,7 +1661,15 @@ SDL_bool
X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display;
Display *display;
if (!data) {
/* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */
SDL_SetError("Window not initialized");
return SDL_FALSE;
}
display = data->videodata->display;
if (info->version.major == SDL_MAJOR_VERSION &&
info->version.minor == SDL_MINOR_VERSION) {