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

Commit

Permalink
Better window parameter checking
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 10, 2011
1 parent 3e10ffd commit 152f59e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/video/SDL_video.c
Expand Up @@ -1339,13 +1339,20 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y)
void
SDL_GetWindowPosition(SDL_Window * window, int *x, int *y)
{
CHECK_WINDOW_MAGIC(window, );

if (x) {
*x = window->x;
}
if (y) {
*y = window->y;
if (_this && window && window->magic == &_this->window_magic) {
if (x) {
*x = window->x;
}
if (y) {
*y = window->y;
}
} else {
if (x) {
*x = 0;
}
if (y) {
*y = 0;
}
}
}

Expand All @@ -1366,7 +1373,7 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h)
void
SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
{
if (window) {
if (_this && window && window->magic == &_this->window_magic) {
if (w) {
*w = window->w;
}
Expand Down

0 comments on commit 152f59e

Please sign in to comment.