Эх сурвалжийг харах

Fix a crash when discord doesn't send an author

Gary Kramlich 3 жил өмнө
parent
commit
210fdda2fc
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 2 2
      bridge/portal.go

+ 2 - 2
bridge/portal.go

@@ -304,7 +304,7 @@ func (p *Portal) markMessageHandled(msg *database.Message, discordID string, mxi
 }
 
 func (p *Portal) handleDiscordMessageCreate(user *User, msg *discordgo.Message) {
-	if user.ID == msg.Author.ID {
+	if msg.Author != nil && user.ID == msg.Author.ID {
 		return
 	}
 
@@ -340,7 +340,7 @@ func (p *Portal) handleDiscordMessageCreate(user *User, msg *discordgo.Message)
 }
 
 func (p *Portal) handleDiscordMessagesUpdate(user *User, msg *discordgo.Message) {
-	if user.ID == msg.Author.ID {
+	if msg.Author != nil && user.ID == msg.Author.ID {
 		return
 	}