From 5c6c123ec6bb75114d3db27f44038696692133f5 Mon Sep 17 00:00:00 2001 From: Michael Czigler <37268479+mcpcpc@users.noreply.github.com> Date: Sat, 17 Oct 2020 08:47:14 -0400 Subject: Check channel for NULL condition (#65) * check channel for NULL condition * fix typo --- kirc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kirc.c') diff --git a/kirc.c b/kirc.c index 7fe67f3..b8772ae 100644 --- a/kirc.c +++ b/kirc.c @@ -510,12 +510,12 @@ static void rawParser(char *string) { printf("%*s<<< \x1b[34;1m%s\x1b[0m", g - 3, "", nickname); } else if (!strncmp(command, "PART", 4)) { printf("%*s<-- \x1b[34;1m%s\x1b[0m", g - 3, "", nickname); - if (strstr(channel, chan_default) == NULL) { + if (channel != NULL && strstr(channel, chan_default) == NULL) { printf(" [\x1b[33m%s\x1b[0m] ", channel); } } else if (!strncmp(command, "JOIN", 4)) { printf("%*s--> \x1b[32;1m%s\x1b[0m", g - 3, "", nickname); - if (strstr(channel, chan_default) == NULL) { + if (channel != NULL && strstr(channel, chan_default) == NULL) { printf(" [\x1b[33m%s\x1b[0m] ", channel); } } else if (!strncmp(command, "NICK", 4)) { -- cgit v1.2.3