Explorar o código

Fix nil pointer dereference

rigormorrtiss %!s(int64=4) %!d(string=hai) anos
pai
achega
fe1f0432c3
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      discordo.go

+ 1 - 1
discordo.go

@@ -113,7 +113,7 @@ func onReady(_ *discordgo.Session, ready *discordgo.Ready) {
 }
 
 func onMessageCreate(_ *discordgo.Session, message *discordgo.MessageCreate) {
-	if currentChannel.ID == message.ChannelID {
+	if currentChannel != nil && currentChannel.ID == message.ChannelID {
 		util.WriteMessage(messagesTextView, session, message.Message)
 	}
 }