From 20119caafa2a9de1d0607af51408d69bdde442ff Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Fri, 22 Dec 2023 20:06:07 +0100 Subject: [PATCH] Restore q_strcasestr behavior with empty needle string This fixes occasional asserts in Con_AddToTabList after 22f442213c7de4051b3da330044c99a5ae0c3871 --- Quake/common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Quake/common.c b/Quake/common.c index 49c5a05ae..78f4af4fa 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -308,6 +308,9 @@ char *q_strcasestr(const char *haystack, const char *needle) { const size_t len = strlen(needle); + if (!len) + return (char *)haystack; + while (*haystack) { if (!q_strncasecmp(haystack, needle, len))