From 44d182e2f93b5652a3e7595030a2f61f1453fdc5 Mon Sep 17 00:00:00 2001 From: Sebastian P <5564491+s3lph@users.noreply.github.com> Date: Thu, 3 Dec 2020 22:25:33 +0100 Subject: Add nil checks to text message handling (mumble) (#1321) --- bridge/mumble/handlers.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bridge/mumble/handlers.go') diff --git a/bridge/mumble/handlers.go b/bridge/mumble/handlers.go index a6845955..40272633 100644 --- a/bridge/mumble/handlers.go +++ b/bridge/mumble/handlers.go @@ -19,6 +19,12 @@ func (b *Bmumble) handleTextMessage(event *gumble.TextMessageEvent) { if event.TextMessage.Sender != nil { sender = event.TextMessage.Sender.Name } + // If the text message is received before receiving a ServerSync + // and UserState, Client.Self or Self.Channel are nil + if event.Client.Self == nil || event.Client.Self.Channel == nil { + b.Log.Warn("Connection bootstrap not finished, discarding text message") + return + } // Convert Mumble HTML messages to markdown parts, err := b.convertHTMLtoMarkdown(event.TextMessage.Message) if err != nil { -- cgit v1.2.3