From 2236142681eb004f06516e623d7d207e722ba11e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 29 Apr 2020 15:00:17 +0200 Subject: [PATCH] Check upstream NOTICE prefix is non-nil --- upstream.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/upstream.go b/upstream.go index 8cfcccd..66e47ec 100644 --- a/upstream.go +++ b/upstream.go @@ -269,6 +269,10 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { }) return nil case "NOTICE": + if msg.Prefix == nil { + return fmt.Errorf("expected a prefix") + } + if msg.Prefix.User == "" && msg.Prefix.Host == "" { // server message uc.produce("", msg, nil) } else { // regular user NOTICE @@ -1087,8 +1091,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { } uc.produce(target, msg, nil) case "INVITE": - var nick string - var channel string + var nick, channel string if err := parseMessageParams(msg, &nick, &channel); err != nil { return err } @@ -1101,8 +1104,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { }) }) case irc.RPL_INVITING: - var nick string - var channel string + var nick, channel string if err := parseMessageParams(msg, &nick, &channel); err != nil { return err }