Skip to content

Commit e144466

Browse files
committed
fix: prevent crash due to nil target in sync_scroll (sindrets#550)
1 parent 4516612 commit e144466

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lua/diffview/scene/layout.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ function Layout:sync_scroll()
305305
end
306306

307307
-- Cursor will sometimes move +- the value of 'scrolloff'
308-
api.nvim_win_set_cursor(target.id, cursor)
308+
if target ~= nil then
309+
api.nvim_win_set_cursor(target.id, cursor)
310+
end
309311
end
310312

311313
M.Layout = Layout

0 commit comments

Comments
 (0)