Do error checking in SDL_GetDisplayForWindow()
This commit is contained in:
parent
5d5c23d421
commit
9619f0bccf
1 changed files with 7 additions and 2 deletions
|
@ -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)
|
||||||
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue