fix: validate oldText and newText before render diff (#2681)
This commit is contained in:
@@ -289,7 +289,13 @@ function M.get_content_lines(content, decoration, truncate)
|
|||||||
table.insert(lines, line)
|
table.insert(lines, line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif content_item.type == "diff" then
|
elseif
|
||||||
|
content_item.type == "diff"
|
||||||
|
and content_item.oldText ~= nil
|
||||||
|
and content_item.newText ~= nil
|
||||||
|
and content_item.oldText ~= vim.NIL
|
||||||
|
and content_item.newText ~= vim.NIL
|
||||||
|
then
|
||||||
local relative_path = Utils.relative_path(content_item.path)
|
local relative_path = Utils.relative_path(content_item.path)
|
||||||
table.insert(lines, Line:new({ { decoration }, { "Path: " .. relative_path } }))
|
table.insert(lines, Line:new({ { decoration }, { "Path: " .. relative_path } }))
|
||||||
local lines_ = M.get_diff_lines(content_item.oldText, content_item.newText, decoration, truncate)
|
local lines_ = M.get_diff_lines(content_item.oldText, content_item.newText, decoration, truncate)
|
||||||
|
|||||||
Reference in New Issue
Block a user