Skip to content

Commit 5c6c123

Browse files
authored
Check channel for NULL condition (#65)
* check channel for NULL condition * fix typo
1 parent 55af820 commit 5c6c123

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kirc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,12 @@ static void rawParser(char *string) {
510510
printf("%*s<<< \x1b[34;1m%s\x1b[0m", g - 3, "", nickname);
511511
} else if (!strncmp(command, "PART", 4)) {
512512
printf("%*s<-- \x1b[34;1m%s\x1b[0m", g - 3, "", nickname);
513-
if (strstr(channel, chan_default) == NULL) {
513+
if (channel != NULL && strstr(channel, chan_default) == NULL) {
514514
printf(" [\x1b[33m%s\x1b[0m] ", channel);
515515
}
516516
} else if (!strncmp(command, "JOIN", 4)) {
517517
printf("%*s--> \x1b[32;1m%s\x1b[0m", g - 3, "", nickname);
518-
if (strstr(channel, chan_default) == NULL) {
518+
if (channel != NULL && strstr(channel, chan_default) == NULL) {
519519
printf(" [\x1b[33m%s\x1b[0m] ", channel);
520520
}
521521
} else if (!strncmp(command, "NICK", 4)) {

0 commit comments

Comments
 (0)