diff src/video/SDL_video.c @ 5247:78ce7bfd0faf

Better window parameter checking
author Sam Lantinga <slouken@libsdl.org>
date Thu, 10 Feb 2011 10:37:35 -0800
parents 9c0593fa27d6
children 3a8a452b49f0
line wrap: on
line diff
--- 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;
         }