By Harry Coin: make IsEmptyStr NULL-pointer-safe.
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 30 Mar 2015 20:53:45 +0000 (22:53 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 30 Mar 2015 20:53:45 +0000 (22:53 +0200)
libcitadel/lib/libcitadel.h
webcit/webcit.h

index 3e48a35f390a1e29782eb237c0376ecaa3261b61..d7da488f10c7a7ab48dbc265924b7da184f96417 100644 (file)
@@ -108,7 +108,7 @@ typedef enum _room_views {
 #define BLOG_EUIDBUF_SIZE      40
 
 #ifndef IsEmptyStr
-#define IsEmptyStr(a) ((a)[0] == '\0')
+#define IsEmptyStr(a) ( ( (a) == NULL ) || ((a)[0] == '\0') )
 #endif
 
 
index 64034c777eb9f2afe842a23952d93d55714b1d82..c5e1fe4222896afa277794108f58ecca58bc39cb 100644 (file)
@@ -61,8 +61,6 @@
 #define _(string)      (string)
 #endif
 
-#define IsEmptyStr(a) ((a)[0] == '\0')
-
 #define DO_DBG_QR 0
 #define DBG_QR(x) if(DO_DBG_QR) _DBG_QR(x)
 #define DBG_QR2(x) if(DO_DBG_QR) _DBG_QR2(x)