From 01a4e4ea3969684fadaeeb9f6a11fb343896084c Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Fri, 16 Sep 2011 08:25:49 -0700 Subject: [PATCH] Add NULL handling in SDL_RectEmpty and SDL_RectEquals --- include/SDL_rect.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/SDL_rect.h b/include/SDL_rect.h index ee3dbff05..a69f94f80 100644 --- a/include/SDL_rect.h +++ b/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)) /**