From 2402bb62384292444ffec53feb73d42b3a65d944 Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Sat, 28 Dec 2024 23:21:14 +0100 Subject: [PATCH] fix crash due to nil target in sync_scroll --- lua/diffview/scene/layout.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/diffview/scene/layout.lua b/lua/diffview/scene/layout.lua index cba2b129..439833bb 100644 --- a/lua/diffview/scene/layout.lua +++ b/lua/diffview/scene/layout.lua @@ -305,7 +305,9 @@ function Layout:sync_scroll() end -- Cursor will sometimes move +- the value of 'scrolloff' - api.nvim_win_set_cursor(target.id, cursor) + if target ~= nil then + api.nvim_win_set_cursor(target.id, cursor) + end end M.Layout = Layout