Fix crash when people delete you as a friend
@@ -1029,7 +1029,12 @@ func (window *Window) registerPrivateChatsHandler() {
window.session.AddHandler(func(s *discordgo.Session, event *discordgo.RelationshipRemove) {
if event.Relationship.Type == discordgo.RelationTypeFriend {
window.app.QueueUpdateDraw(func() {
- window.privateList.RemoveFriend(event.User.ID)
+ for _, relationship := range window.session.State.Relationships {
+ if relationship.ID == event.ID {
+ window.privateList.RemoveFriend(relationship.User.ID)
+ break
+ }
+ }
})
}
})
