Skip to content

Commit

Permalink
service/dap: fix nil ptr deref when current addr is not in a func
Browse files Browse the repository at this point in the history
Fixes nil pointer dereference when current PC address does not belong
to any known func.

Fixes #3156
  • Loading branch information
aarzilli committed Oct 5, 2022
1 parent 6e7e1d8 commit e0f6453
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 e0f6453

Please sign in to comment.