Commit 9619f0bc authored by Sam Lantinga's avatar Sam Lantinga

Do error checking in SDL_GetDisplayForWindow()

parent 5d5c23d4
...@@ -888,7 +888,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * ...@@ -888,7 +888,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode *
} }
int int
SDLCALL SDL_GetWindowDisplay(SDL_Window * window) SDL_GetWindowDisplay(SDL_Window * window)
{ {
int displayIndex; int displayIndex;
int i, dist; int i, dist;
...@@ -945,7 +945,12 @@ SDLCALL SDL_GetWindowDisplay(SDL_Window * window) ...@@ -945,7 +945,12 @@ SDLCALL SDL_GetWindowDisplay(SDL_Window * window)
SDL_VideoDisplay * SDL_VideoDisplay *
SDL_GetDisplayForWindow(SDL_Window *window) SDL_GetDisplayForWindow(SDL_Window *window)
{ {
return &_this->displays[SDL_GetWindowDisplay(window)]; int displayIndex = SDL_GetWindowDisplay(window);
if (displayIndex >= 0) {
return &_this->displays[displayIndex];
} else {
return NULL;
}
} }
int int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment