Fixes a nil pointer dereference by checking a nil value for the

OnAddedToGroup handler.
This commit is contained in:
Martin Ottenwaelter 2017-12-08 12:09:32 +01:00
parent a3451788c3
commit 6adfa4be13

6
bot.go
View File

@ -190,9 +190,9 @@ func (b *Bot) incomingUpdate(upd *Update) {
return
}
// OnAddedToGrop
wasAdded := m.UserJoined.ID == b.Me.ID ||
m.UsersJoined != nil && isUserInList(b.Me, m.UsersJoined)
// OnAddedToGroup
wasAdded := (m.UserJoined != nil && m.UserJoined.ID == b.Me.ID) ||
(m.UsersJoined != nil && isUserInList(b.Me, m.UsersJoined))
if m.GroupCreated || m.SuperGroupCreated || wasAdded {
b.handle(OnAddedToGroup, m)
return