Better window parameter checking
authorSam Lantinga <slouken@libsdl.org>
Thu, 10 Feb 2011 10:37:35 -0800
changeset 524278ce7bfd0faf
parent 5241 189b1bdb7baf
child 5243 3a8a452b49f0
Better window parameter checking
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Thu Feb 10 05:10:05 2011 -0800
     1.2 +++ b/src/video/SDL_video.c	Thu Feb 10 10:37:35 2011 -0800
     1.3 @@ -1339,13 +1339,20 @@
     1.4  void
     1.5  SDL_GetWindowPosition(SDL_Window * window, int *x, int *y)
     1.6  {
     1.7 -    CHECK_WINDOW_MAGIC(window, );
     1.8 -
     1.9 -    if (x) {
    1.10 -        *x = window->x;
    1.11 -    }
    1.12 -    if (y) {
    1.13 -        *y = window->y;
    1.14 +    if (_this && window && window->magic == &_this->window_magic) {
    1.15 +        if (x) {
    1.16 +            *x = window->x;
    1.17 +        }
    1.18 +        if (y) {
    1.19 +            *y = window->y;
    1.20 +        }
    1.21 +    } else {
    1.22 +        if (x) {
    1.23 +            *x = 0;
    1.24 +        }
    1.25 +        if (y) {
    1.26 +            *y = 0;
    1.27 +        }
    1.28      }
    1.29  }
    1.30  
    1.31 @@ -1366,7 +1373,7 @@
    1.32  void
    1.33  SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
    1.34  {
    1.35 -    if (window) {
    1.36 +    if (_this && window && window->magic == &_this->window_magic) {
    1.37          if (w) {
    1.38              *w = window->w;
    1.39          }