From 98c471390e5ec942585fbc790f0439e9ccb2ffdf Mon Sep 17 00:00:00 2001 From: Alex Volkov Date: Thu, 5 Mar 2026 06:42:24 -0800 Subject: [PATCH] fix(render): handle nil changes when cycling tabs when cycling through tabs more than once, the changes appear to be nil starting with the second cycle. As such, nil is passed down to the iterator factory. Add a defensive nil check beforehand --- lua/codediff/ui/core.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/codediff/ui/core.lua b/lua/codediff/ui/core.lua index 7e34b25..73dfd3e 100644 --- a/lua/codediff/ui/core.lua +++ b/lua/codediff/ui/core.lua @@ -323,6 +323,7 @@ function M.render_diff(left_bufnr, right_bufnr, original_lines, modified_lines, local last_orig_line = 1 local last_mod_line = 1 + if not lines_diff.changes then return end for _, mapping in ipairs(lines_diff.changes) do local orig_is_empty = (mapping.original.end_line <= mapping.original.start_line) local mod_is_empty = (mapping.modified.end_line <= mapping.modified.start_line)