diff options
author | Wim <wim@42.be> | 2018-05-05 23:15:50 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-05-05 23:15:50 +0200 |
commit | ee4ac67081a4155a2b5852b9c9c2161084adefe0 (patch) | |
tree | 563c63f80d6b1716112c38fd53e0a0c38f3e0644 /bridge/telegram | |
parent | 5a93d14d75351a1b8b5a2963df2909f1daf6ce3f (diff) | |
download | matterbridge-msglm-ee4ac67081a4155a2b5852b9c9c2161084adefe0.tar.gz matterbridge-msglm-ee4ac67081a4155a2b5852b9c9c2161084adefe0.tar.bz2 matterbridge-msglm-ee4ac67081a4155a2b5852b9c9c2161084adefe0.zip |
Fix possible nil when using channels (telegram). #410
Diffstat (limited to 'bridge/telegram')
-rw-r--r-- | bridge/telegram/telegram.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index c958aba2..a5cba288 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -229,7 +229,10 @@ 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) |