Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Do error checking in SDL_GetDisplayForWindow()
  • Loading branch information
slouken committed Feb 21, 2011
1 parent c8a3053 commit 47e5d7c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/video/SDL_video.c
Expand Up @@ -888,7 +888,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode *
}

int
SDLCALL SDL_GetWindowDisplay(SDL_Window * window)
SDL_GetWindowDisplay(SDL_Window * window)
{
int displayIndex;
int i, dist;
Expand Down Expand Up @@ -945,7 +945,12 @@ SDLCALL SDL_GetWindowDisplay(SDL_Window * window)
SDL_VideoDisplay *
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
Expand Down

0 comments on commit 47e5d7c

Please sign in to comment.