Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add NULL handling in SDL_RectEmpty and SDL_RectEquals

  • Loading branch information
ferzkopp committed Sep 16, 2011
1 parent 301cb8d commit 01a4e4ea3969684fadaeeb9f6a11fb343896084c
Showing with 3 additions and 2 deletions.
  1. +3 −2 include/SDL_rect.h
@@ -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))

/**

0 comments on commit 01a4e4e

Please sign in to comment.