summaryrefslogtreecommitdiff
path: root/src/z-util.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-07 14:50:53 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-07 15:26:37 +0200
commit13543856597dc59f3cf8b7ecbf7d2e77e07c7f69 (patch)
treeddbeea3a771cece4ebaaea014a18ae4af991b5ac /src/z-util.c
parent91583724b59f6ab9744d14c6056e45cd6643de80 (diff)
Make streq() robust to NULL pointers
Diffstat (limited to 'src/z-util.c')
-rw-r--r--src/z-util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/z-util.c b/src/z-util.c
index 76120833..7c5374f3 100644
--- a/src/z-util.c
+++ b/src/z-util.c
@@ -127,6 +127,9 @@ bool_ func_false(void)
*/
bool_ streq(cptr a, cptr b)
{
+ if ((a == NULL) && (b == NULL)) { return TRUE; }
+ if (a == NULL) { return FALSE; }
+ if (b == NULL) { return FALSE; }
return (!strcmp(a, b));
}