From 0cdb4fef03126fa4220ff00ab4a85be48c594281 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Sat, 31 Mar 2001 06:51:17 +0000 Subject: Handle NULL args semi-gracefully. 2001-03-31 Jon Trowbridge * gal/util/e-util.c (g_str_compare): Handle NULL args semi-gracefully. svn path=/trunk/; revision=9066 --- e-util/e-util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e-util/e-util.c b/e-util/e-util.c index 8f393e1b86..18975375e6 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -40,7 +40,14 @@ int g_str_compare(const void *x, const void *y) { - return strcmp(x, y); + if (x == NULL || y == NULL) { + if (x == y) + return 0; + else + return x ? -1 : 1; + } + + return strcmp(x, y); } int -- cgit v1.2.3