Skip to content

Got panic sometime #3

@vincent-tr

Description

@vincent-tr

Hello,

Sometime I get this panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x558f1de7c0]

goroutine 2374 [running]:
[github.com/sgrimee/kizcool.(*Kiz).PollEvents(0x4000f99da0](http://github.com/sgrimee/kizcool.(*Kiz).PollEvents(0x4000f99da0)?)
        /root/go/pkg/mod/[github.com/sgrimee/kizcool@v0.0.0-20191223231822-10e10a24e73a/kizcool.go:265](http://github.com/sgrimee/kizcool@v0.0.0-20191223231822-10e10a24e73a/kizcool.go:265) +0x90
...

After reading the code:
I see that in DoWithAuth function, at the first c.hc.Do(req) we check the result with checkStatusOk.
After the second call, if a Login occured, we do not.
And actually checkStatusOk ensure that there is a response Body.
(note that addr=0x40 correspond to the offset of Body in http.Response structure).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions