amir-the-h / okex

Golang API wrapper of OkEX
Apache License 2.0
100 stars 97 forks source link

nil pointer dereference #5

Closed renat1015 closed 2 years ago

renat1015 commented 2 years ago

Hello @amir-the-h! /github.com/amir-the-h/okex@v1.0.26-alpha/api/ws/client.go:238

conn, res, err := websocket.DefaultDialer.Dial(string(c.url[p]), nil) defer res.Body.Close()

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

Can this problem be caused due to res nil? Thanks!

github-actions[bot] commented 2 years ago

Message that will be displayed on users first issue

amir-the-h commented 2 years ago

Hey @renat1015, you are probably right. I've merged your PR and released a new version. I'm currently not able to test it out. Try to checkout v1.0.28-alpha and give it a try.

Closed by #6

renat1015 commented 2 years ago

call defer we fixed! only the problem with the null pointer was not solved.. I added another merge request. calling the dial function sometimes returns a res (*http.Response) nil when the error is not nil. @amir-the-h thanks for the fast feedback!