hirc

IRC client
Log | Files | Refs

commit ee911b44d6ea7ae2ccb98ce62f009dc8a07d0309
parent c3d76661cbb261590328929253a90157937e2cec
Author: hhvn <dev@hhvn.uk>
Date:   Tue, 30 Nov 2021 17:27:03 +0000

commands.c: stop /topic segfault

Diffstat:
Mcommands.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/commands.c b/commands.c @@ -428,8 +428,12 @@ command_topic(struct Server *server, char *str) { } } - channel = strtok_r(str, " ", &topic); - if (!strchr(support_get(server, "CHANTYPES"), *channel)) { + if (str) + channel = strtok_r(str, " ", &topic); + else + channel = topic = NULL; + + if (channel && !strchr(support_get(server, "CHANTYPES"), *channel)) { topic = channel; channel = NULL; }