From f2f99c891d575a2982667ef1af876a4e72ca02e3 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 9 May 2010 13:08:56 +0000 Subject: [PATCH] fix segfault on empty slots in a stringbuffer on buf_sort git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10183 d7cf8633-e32d-0410-b094-e92efae38249 --- prvm_cmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prvm_cmds.c b/prvm_cmds.c index f93133e6..a7450c6a 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -4463,8 +4463,8 @@ static int BufStr_SortStringsUP (const void *in1, const void *in2) const char *a, *b; a = *((const char **) in1); b = *((const char **) in2); - if(!a[0]) return 1; - if(!b[0]) return -1; + if(!a || !a[0]) return 1; + if(!b || !b[0]) return -1; return strncmp(a, b, stringbuffers_sortlength); } @@ -4473,8 +4473,8 @@ static int BufStr_SortStringsDOWN (const void *in1, const void *in2) const char *a, *b; a = *((const char **) in1); b = *((const char **) in2); - if(!a[0]) return 1; - if(!b[0]) return -1; + if(!a || !a[0]) return 1; + if(!b || !b[0]) return -1; return strncmp(b, a, stringbuffers_sortlength); } -- 2.39.2