From 7bf5836cda50645c2027a0d9a9fd19f48c44b4af Mon Sep 17 00:00:00 2001 From: Michael Czigler <37268479+mcpcpc@users.noreply.github.com> Date: Sat, 17 Oct 2020 08:35:34 -0400 Subject: [PATCH 1/2] check channel for NULL condition --- kirc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kirc.c b/kirc.c index 7fe67f3..931053f 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 && sstrstr(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)) { From e93ed2f2409a63942ed90dc91f9fa56bdaea9dd8 Mon Sep 17 00:00:00 2001 From: Michael Czigler <37268479+mcpcpc@users.noreply.github.com> Date: Sat, 17 Oct 2020 08:37:29 -0400 Subject: [PATCH 2/2] fix typo --- kirc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kirc.c b/kirc.c index 931053f..b8772ae 100644 --- a/kirc.c +++ b/kirc.c @@ -510,7 +510,7 @@ 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 (channel != NULL && sstrstr(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)) {