Add NULL handling in SDL_RectEmpty and SDL_RectEquals
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Fri, 16 Sep 2011 08:25:49 -0700
changeset 59472abc5a4210d5
parent 5942 00b695dde4bf
child 5948 05e6bfac079f
Add NULL handling in SDL_RectEmpty and SDL_RectEquals
include/SDL_rect.h
     1.1 --- a/include/SDL_rect.h	Thu Sep 15 23:55:36 2011 -0400
     1.2 +++ b/include/SDL_rect.h	Fri Sep 16 08:25:49 2011 -0700
     1.3 @@ -71,12 +71,13 @@
     1.4  /**
     1.5   *  \brief Returns true if the rectangle has no area.
     1.6   */
     1.7 -#define SDL_RectEmpty(X)    (((X)->w <= 0) || ((X)->h <= 0))
     1.8 +#define SDL_RectEmpty(X)    ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0))
     1.9  
    1.10  /**
    1.11   *  \brief Returns true if the two rectangles are equal.
    1.12   */
    1.13 -#define SDL_RectEquals(A, B)   (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
    1.14 +#define SDL_RectEquals(A, B)   (((A) && ((B)) && \
    1.15 +                                ((A)->x == (B)->x) && ((A)->y == (B)->y) && \
    1.16                                  ((A)->w == (B)->w) && ((A)->h == (B)->h))
    1.17  
    1.18  /**