From 6beb96100a0e421b288acecd92b0aed8af2eed44 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 12 Nov 2001 03:32:04 +0000 Subject: [PATCH] fix a seg when the chat message doesn't have : in it --- qw/source/teamplay.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/qw/source/teamplay.c b/qw/source/teamplay.c index 07b75659b..81274c44c 100644 --- a/qw/source/teamplay.c +++ b/qw/source/teamplay.c @@ -454,18 +454,22 @@ Team_ParseChat (const char *string) char *s; int i; - s = strchr(string, ':') + 1; + if (!cl_freply->value) + return; + + s = strchr(string, ':'); + if (!(s = strchr(string, ':'))) + return; + s++; while (isspace(*s)) s++; - if (s && cl_freply->value) { - for (i = 0; f_replies[i].name; i++) { - if (!strncmp(f_replies[i].name, s, strlen(f_replies[i].name)) && cl_freply->value) { - while (*s && !isspace(*s)) - s++; - Cbuf_AddText(f_replies[i].func(s)); - f_replies[i].lasttime = realtime; - } + for (i = 0; f_replies[i].name; i++) { + if (!strncmp(f_replies[i].name, s, strlen(f_replies[i].name)) && cl_freply->value) { + while (*s && !isspace(*s)) + s++; + Cbuf_AddText(f_replies[i].func(s)); + f_replies[i].lasttime = realtime; } } }