amir-the-h / okex

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

fix nil pointer dereference #7

Closed renat1015 closed 2 years ago

renat1015 commented 2 years ago

calling the dial function sometimes returns a res (*http.Response) nil when the error is not nil

renat1015 commented 2 years ago

In this case, we are initializing the res variable to display the statusCode. The question of the rationality of adding a check of the res to nil, only for the conclusion is debatable. But the project is yours - and you decide!

If you decide so, I can fix it or you make the changes yourself. I use your library - and it's holding me up now(

amir-the-h commented 2 years ago

I understand what you are saying. But that httpResponse will give us some good information on some points. I think it's better to have it and add some extra checks.

renat1015 commented 2 years ago

I agree with you and fixed my commit!