Add NULL handling in SDL_RectEmpty and SDL_RectEquals

This commit is contained in:
Andreas Schiffler 2011-09-16 08:25:49 -07:00
parent a90884b482
commit 6e3ff8fdf5

View file

@ -71,12 +71,13 @@ typedef struct SDL_Rect
/**
* \brief Returns true if the rectangle has no area.
*/
#define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0))
#define SDL_RectEmpty(X) ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0))
/**
* \brief Returns true if the two rectangles are equal.
*/
#define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
#define SDL_RectEquals(A, B) (((A) && ((B)) && \
((A)->x == (B)->x) && ((A)->y == (B)->y) && \
((A)->w == (B)->w) && ((A)->h == (B)->h))
/**