Commit 6e3ff8fd authored by Andreas Schiffler's avatar Andreas Schiffler

Add NULL handling in SDL_RectEmpty and SDL_RectEquals

parent a90884b4
...@@ -71,12 +71,13 @@ typedef struct SDL_Rect ...@@ -71,12 +71,13 @@ typedef struct SDL_Rect
/** /**
* \brief Returns true if the rectangle has no area. * \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. * \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)) ((A)->w == (B)->w) && ((A)->h == (B)->h))
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment