telegram-bot-api icon indicating copy to clipboard operation
telegram-bot-api copied to clipboard

runtime error on update.Message.Poll

Open whimax opened this issue 1 year ago • 0 comments

Hi! I've test this code:

updates := bot.GetUpdatesChan(u)
for update := range updates {
    if update.Message.Poll != nil {
      fmt.Printf("poll\n")
    }
    if update.Message != nil {
      fmt.Printf("msg %v\n", update.Message)
      poll := tgbotapi.NewPoll(update.Message.Chat.ID, "test poll", "1", "2", "3")
      bot.Send(poll)
    }
}

when bot send poll update.Message.Poll not nil and contain poll params, but check "update.Message.Poll != nil" result error: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x63b863]

whimax avatar Sep 27 '22 10:09 whimax