From d410e03ca334140760b7ee9ad356d6f035e2563e Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 7 Feb 2023 11:17:15 -0500 Subject: Fix segfault parsing line with only tags --- bounce.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bounce.h b/bounce.h index e196ed0..93a3c89 100644 --- a/bounce.h +++ b/bounce.h @@ -69,8 +69,8 @@ struct Message { static inline struct Message parse(char *line) { struct Message msg = {0}; - if (line[0] == '@') msg.tags = 1 + strsep(&line, " "); - if (line[0] == ':') msg.origin = 1 + strsep(&line, " "); + if (line && line[0] == '@') msg.tags = 1 + strsep(&line, " "); + if (line && line[0] == ':') msg.origin = 1 + strsep(&line, " "); msg.cmd = strsep(&line, " "); for (size_t i = 0; line && i < ParamCap; ++i) { if (line[0] == ':') { -- cgit 1.4.1