Skip to content

Commit 63517f5

Browse files
committed
Fix edge case for falsy values
1 parent 393c55b commit 63517f5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/debug/server_dap.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,9 @@ def process_dap args
867867
event! :protocol_result, :scope, req, variables: vars, tid: self.id
868868
when :variable
869869
vid = args.shift
870-
obj = @var_map[vid]
871-
if obj
870+
if @var_map.key?(vid)
871+
obj = @var_map[vid]
872+
872873
members = case req.dig('arguments', 'filter')
873874
when 'indexed'
874875
VariableInspector.new.indexed_members_of(

test/protocol/step_back_raw_dap_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ def test_step_back_works_correctly
883883
namedVariables: /\d+/,
884884
indexedVariables: 0,
885885
expensive: false,
886-
variablesReference: 11
886+
variablesReference: 12
887887
},
888888
{
889889
name: "Global variables",
@@ -917,15 +917,15 @@ def test_step_back_works_correctly
917917
name: "%self",
918918
value: "Foo",
919919
type: "Module",
920-
variablesReference: 12,
920+
variablesReference: 13,
921921
indexedVariables: 0,
922922
namedVariables: /\d+/
923923
},
924924
{
925925
name: "bar",
926926
value: "nil",
927927
type: "NilClass",
928-
variablesReference: 13,
928+
variablesReference: 14,
929929
indexedVariables: 0,
930930
namedVariables: /\d+/
931931
}

0 commit comments

Comments
 (0)