wxBot4g icon indicating copy to clipboard operation
wxBot4g copied to clipboard

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

Open apmcool opened this issue 5 years ago • 5 comments

Hi, thanks for the codes, I encountered this problem, may I know how to solve it please? Thank you!

{"file":"/Users/hfl/wxBot4g-master/wcbot/wcbot.go:281","func":"wxBot4g/wcbot.(*WcBot).genQrCode","level":"info","msg":"please use WeChat to scan the QR code","time":"2020-01-05T16:17:07+11:00"} {"file":"/Users/hfl/wxBot4g-master/wcbot/wcbot.go:313","func":"wxBot4g/wcbot.(*WcBot).wait4login","level":"info","msg":"please confirm to login","time":"2020-01-05T16:17:30+11:00"} panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x1677186]

goroutine 1 [running]: github.com/beevik/etree.(*Element).Text(0x0, 0x186acc7, 0x4) /Users/hfl/go/pkg/mod/github.com/beevik/[email protected]/etree.go:426 +0x26 wxBot4g/wcbot.(*WcBot).login(0xc000187200, 0x186a06f) /Users/hfl/wxBot4g-master/wcbot/wcbot.go:364 +0x1fe wxBot4g/wcbot.(*WcBot).Run(0xc000187200) /Users/hfl/wxBot4g-master/wcbot/wcbot.go:197 +0x23d main.main() /Users/hfl/wxBot4g-master/main.go:46 +0x79

apmcool avatar Jan 05 '20 05:01 apmcool

Hi, thanks for the codes, I encountered this problem, may I know how to solve it please? Thank you!

{"file":"/Users/hfl/wxBot4g-master/wcbot/wcbot.go:281","func":"wxBot4g/wcbot.(*WcBot).genQrCode","level":"info","msg":"please use WeChat to scan the QR code","time":"2020-01-05T16:17:07+11:00"} {"file":"/Users/hfl/wxBot4g-master/wcbot/wcbot.go:313","func":"wxBot4g/wcbot.(*WcBot).wait4login","level":"info","msg":"please confirm to login","time":"2020-01-05T16:17:30+11:00"} panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x1677186]

goroutine 1 [running]: github.com/beevik/etree.(*Element).Text(0x0, 0x186acc7, 0x4) /Users/hfl/go/pkg/mod/github.com/beevik/[email protected]/etree.go:426 +0x26 wxBot4g/wcbot.(*WcBot).login(0xc000187200, 0x186a06f) /Users/hfl/wxBot4g-master/wcbot/wcbot.go:364 +0x1fe wxBot4g/wcbot.(*WcBot).Run(0xc000187200) /Users/hfl/wxBot4g-master/wcbot/wcbot.go:197 +0x23d main.main() /Users/hfl/wxBot4g-master/main.go:46 +0x79

Hi, @apmcool. You can refer to my issue. I think this caused by the typo in the code. Let me know if you can log in by fixing it.

zhongqin0820 avatar Jan 06 '20 05:01 zhongqin0820

okay, thanks for your help!

apmcool avatar Jan 06 '20 10:01 apmcool

你们的微信还能使用 web api??

fanybook avatar Jan 22 '20 09:01 fanybook

@apmcool
hello,i try it just now, wechat bot is ok. or you can show me the error log. If your wechat account registered after 2018? Wechat account registered after 2018 can't log in with Web

liangjfblue avatar Jan 23 '20 08:01 liangjfblue

@fanybook yes, you can call web api /v1/msg/text or /v1/msg/image to friend or group

liangjfblue avatar Jan 23 '20 08:01 liangjfblue