-
Notifications
You must be signed in to change notification settings - Fork 91
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nil pointer exception in req() method #25
Comments
Closed
Yes. It got lost. You are a contributer and you have permission to write/push too. Don't open issues. Use this time an push your fix, even if you're not 100% shure, all things improveable! |
Just try to avoid merge commits. 😀 |
chripo
pushed a commit
that referenced
this issue
Oct 21, 2018
http.Do() method will return non-nil [error] in following cases: 1. Request is nil 2. Response missing Location header 3. Client failed to parse Location header 4. Method "request.GetBody()" returns error 5. Http.Client.Send() returns error 5. Client timeout was exceeded Signed-off-by: Christoph Polcin <labs@polcin.de>
@chripo, ok, thanks 😄 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Software
OS: Windows 10 x64
GO: go1.9.2 windows/amd64
gowebdav: latest version from
master
go env
Issue description
We use
http.Do()
method insidec.req()
, and do not check for errors returned. So, it is possible to receivenil
response, and gotnil pointer dereference panic
in line 42.http.Do()
method will return non-nilerror
in following cases:In all cases except of (5) this method returns
nil
as a poiner tohttp.Response
, which will force app to panic later.Conclusion
Taking into account the above mentioned, we need to perform error-checking for
http.Do()
method results.The text was updated successfully, but these errors were encountered: