go-telegram / bot

Telegram Bot API Go framework
MIT License
502 stars 46 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #71

Closed waldirborbajr closed 3 months ago

waldirborbajr commented 3 months ago

I'm facing a nil pointer dereference. That it is getting me crazy.

I created an empty project, copy and past echo example, and run it. When I send a message from Telegram. The bot die whith the error below.

go version
go version go1.22.1 linux/amd64

uname -a          
on  main [!×1 ?×2 ]  v1.22.1 v1.76.0
Linux pop-os 6.6.10-76060610-generic #202401051437~1709764300~22.04~379e7a9 SMP PREEMPT_DYNAMIC Thu M x86_64 x86_64 x86_64 GNU/Linux

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x6735e0]

goroutine 53 [running]: main.handler({0x77b370, 0xc0000dc1c0}, 0xc0000000c0, 0xc0003480a0) /home/borba/wks/go/BomBot/main.go:33 +0x40 github.com/go-telegram/bot.(Bot).ProcessUpdate.func1() /home/borba/go/pkg/mod/github.com/go-telegram/bot@v1.1.7/process_update.go:25 +0x6d github.com/go-telegram/bot.(Bot).ProcessUpdate(0xc00002a5a0?, {0x77b370?, 0xc0000dc1c0?}, 0xc00004f758?) /home/borba/go/pkg/mod/github.com/go-telegram/bot@v1.1.7/process_update.go:36 +0xc3 github.com/go-telegram/bot.(Bot).waitUpdates.func1({0x77b370, 0xc0000dc1c0}, 0xc0000dc1c0?, 0xc0001c6000) /home/borba/go/pkg/mod/github.com/go-telegram/bot@v1.1.7/wait_updates.go:29 +0x93 created by github.com/go-telegram/bot.(Bot).waitUpdates in goroutine 20 /home/borba/go/pkg/mod/github.com/go-telegram/bot@v1.1.7/wait_updates.go:26 +0x228 exit status 2 make: *** [Makefile:20: run] Error 1