mirror of https://github.com/libsdl-org/SDL.git
wayland: Prevent a possible crash when determining the display for a minimized window
A minimized window may not be associated with any displays, so check that the output array is valid and that there is at least one associated display before dereferencing. Fixes a crash when attempting to unset fullscreen on a minimized window.
This commit is contained in:
parent
a98774e62c
commit
41532e84cb
|
|
@ -494,9 +494,16 @@ static void FlushFullscreenEvents(SDL_Window *window)
|
|||
static void Wayland_move_window(SDL_Window *window)
|
||||
{
|
||||
SDL_WindowData *wind = window->driverdata;
|
||||
SDL_DisplayData *display = wind->outputs[wind->num_outputs - 1];
|
||||
SDL_DisplayData *display;
|
||||
SDL_DisplayID *displays;
|
||||
|
||||
if (wind->outputs && wind->num_outputs) {
|
||||
display = wind->outputs[wind->num_outputs - 1];
|
||||
} else {
|
||||
/* A window may not be on any displays if minimized. */
|
||||
return;
|
||||
}
|
||||
|
||||
displays = SDL_GetDisplays(NULL);
|
||||
if (displays) {
|
||||
for (int i = 0; displays[i]; ++i) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue