5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-25 08:41:36 +00:00

Add nil checks to text message handling (mumble) (#1321)

This commit is contained in:
Sebastian P 2020-12-03 22:25:33 +01:00 committed by GitHub
parent ad95e35687
commit 44d182e2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {