Skip to content

Commit

Permalink
fix: check if data is accessible (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintelm authored Feb 23, 2023
1 parent bf9f0c4 commit f6137d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lua/dapui/components/frames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ return function(client, send_ready)
---@param canvas dapui.Canvas
render = function(canvas, thread_id, show_subtle, indent)
local success, response = pcall(client.request.stackTrace, { threadId = thread_id })
local current_frame_id = nil

if not success then
return
Expand All @@ -25,7 +26,9 @@ return function(client, send_ready)
end, frames)
end

local current_frame_id = client.session.current_frame and client.session.current_frame.id
if client.session then
current_frame_id = client.session.current_frame and client.session.current_frame.id
end

for _, frame in ipairs(frames) do
local is_current = frame.id == current_frame_id
Expand Down
4 changes: 3 additions & 1 deletion lua/dapui/components/scopes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ return function(client, send_ready)
---@type dapui.types.Scope[] | nil
local _scopes
client.listen.scopes(function(args)
_scopes = args.response.scopes
if args.response then
_scopes = args.response.scopes
end
send_ready()
end)
local on_exit = function()
Expand Down

0 comments on commit f6137d7

Please sign in to comment.