Better window parameter checking
authorSam Lantinga <slouken@libsdl.org>
Thu, 10 Feb 2011 10:37:35 -0800
changeset 5242 78ce7bfd0faf
parent 5241 189b1bdb7baf
child 5243 3a8a452b49f0
Better window parameter checking
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Thu Feb 10 05:10:05 2011 -0800
+++ b/src/video/SDL_video.c	Thu Feb 10 10:37:35 2011 -0800
@@ -1339,13 +1339,20 @@
 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 @@
 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;
         }