Skip to content

Commit

Permalink
fix(state): check for request in listener
Browse files Browse the repository at this point in the history
If a request is made after the session has terminated, a response can
still be given but the request will be nil because nvim-dap clears the
request cache.

See #111
  • Loading branch information
rcarriga committed Jun 18, 2022
1 parent 923eb14 commit 52f4840
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/dapui/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function UIState:attach(dap, listener_id)
end

dap.listeners.after.variables[listener_id] = function(session, err, response, request)
if not request then
-- Session has been closed since request was made.
return
end
if not err then
for _, variable in pairs(response.variables) do
if self._monitored_vars[variable.variablesReference] then
Expand Down

0 comments on commit 52f4840

Please sign in to comment.