Skip to content

Commit

Permalink
service/dap: fix nil ptr deref when current addr is not in a func (go…
Browse files Browse the repository at this point in the history
…-delve#3157)

Fixes nil pointer dereference when current PC address does not belong
to any known func.

Fixes go-delve#3156
  • Loading branch information
aarzilli authored Oct 5, 2022
1 parent cd8cf3b commit 6440b3b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion service/dap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,11 @@ func (s *Session) onScopesRequest(request *dap.ScopesRequest) {
// Check if the function is optimized.
fn, err := s.debugger.Function(int64(goid), frame, 0, DefaultLoadConfig)
if fn == nil || err != nil {
s.sendErrorResponse(request.Request, UnableToListArgs, "Unable to find enclosing function", err.Error())
var details string
if err != nil {
details = err.Error()
}
s.sendErrorResponse(request.Request, UnableToListArgs, "Unable to find enclosing function", details)
return
}
suffix := ""
Expand Down

0 comments on commit 6440b3b

Please sign in to comment.