File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
lua/diffview/scene/views/diff Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -78,21 +78,25 @@ return function(view)
7878 if view .panel :is_open () then
7979 --- @type any
8080 local item = view .panel :get_item_at_cursor ()
81- if type (item .collapsed ) == " boolean" then
82- view .panel :toggle_item_fold (item )
83- else
84- view :set_file (item , false )
81+ if item then
82+ if type (item .collapsed ) == " boolean" then
83+ view .panel :toggle_item_fold (item )
84+ else
85+ view :set_file (item , false )
86+ end
8587 end
8688 end
8789 end ,
8890 focus_entry = function ()
8991 if view .panel :is_open () then
9092 --- @type any
9193 local item = view .panel :get_item_at_cursor ()
92- if type (item .collapsed ) == " boolean" then
93- view .panel :toggle_item_fold (item )
94- else
95- view :set_file (item , true )
94+ if item then
95+ if type (item .collapsed ) == " boolean" then
96+ view .panel :toggle_item_fold (item )
97+ else
98+ view :set_file (item , true )
99+ end
96100 end
97101 end
98102 end ,
You can’t perform that action at this time.
0 commit comments