Closed foxcool closed 6 years ago
Yes, it looks like that I have experimenting something with http client and only partially pushed something to GitHub. I do have exactly the same lines in my code, but uncommitted. O:)
I will check my code again and do it right or include your changes, or revers it back while I was using http.DefaultClient. I had some issues and I thought it was because of the viber client, but it turned out that problem has nothing to do with viber package.
Now I was curious how my app on top of this package works since I use GitHub code while building on target server, but it turns out that I'm using viber.New() which do initialize http.Client. :)
I have accepted your code, also pushed some of my commits so please update. SetRequestTimeout() also sufferered from the same bug if client was nil.
Thanks 👍
Error catched on sending message after webhook handling.
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x96f422]
When we handle webhooks from viber, we create instance by this way:
May be this is bad way, and we need to use .New() method everywhere, beause v.client is nil.
My fix: just check and init &http.Client{} if client is nil.