Skip to content

Commit

Permalink
fix insurance, check that the object is still active before disconnec…
Browse files Browse the repository at this point in the history
…ting

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

goroutine 1 [running]:
github.com/stmcginnis/gofish.(*APIClient).Logout(0x0?)
        /Users/max/Desktop/code/device-mgr/vendor/github.com/stmcginnis/gofish/client.go:576 +0xe
panic({0x13e4040?, 0x1812cf0?})
  • Loading branch information
Maksim Kovshov committed Jan 30, 2024
1 parent 7eb0508 commit f614607
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func (c *APIClient) dumpResponse(resp *http.Response) error {
// Logout will delete any active session. Useful to defer logout when creating
// a new connection.
func (c *APIClient) Logout() {
if c.Service != nil && c.auth != nil {
if c != nil && c.Service != nil && c.auth != nil {
_ = c.Service.DeleteSession(c.auth.Session)
}
}
Expand Down

0 comments on commit f614607

Please sign in to comment.