Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 905e252876fd6417dd1773a4fd8de1f2360a7550 Author: Wim <wim@42.be> Date: Sat May 05 23:15:50 2018 +0000 Fix possible nil when using channels (telegram). #410 diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index c958aba..a5cba28 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -2297 +22910 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {     if rmsg.Text != "" || len(rmsg.Extra) > 0 {   rmsg.Text = helper.RemoveEmptyNewLines(rmsg.Text) - rmsg.Avatar = helper.GetAvatar(b.avatarMap, strconv.Itoa(message.From.ID), b.General) + // channels don't have (always?) user information. see #410 + if message.From != nil { + rmsg.Avatar = helper.GetAvatar(b.avatarMap, strconv.Itoa(message.From.ID), b.General) + }     b.Log.Debugf("<= Sending message from %s on %s to gateway", rmsg.Username, b.Account)   b.Log.Debugf("<= Message is %#v", rmsg)