Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Add NULL handling in SDL_RectEmpty and SDL_RectEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
ferzkopp committed Sep 16, 2011
1 parent 301cb8d commit 01a4e4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/SDL_rect.h
Expand Up @@ -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))

/**
Expand Down

0 comments on commit 01a4e4e

Please sign in to comment.