From c4f308a1bef7bcf245d75522f72491b0f921acd6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 10 Feb 2011 10:37:35 -0800 Subject: [PATCH] Better window parameter checking --- src/video/SDL_video.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 52bc646d4..e3650c45b 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -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; + } } } @@ -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; }