fix<TextDiffView>: avoid endLine out of range

This commit is contained in:
leo 2024-02-29 12:16:31 +08:00
parent 2b97d7c599
commit a770ff542d

View file

@ -852,6 +852,7 @@ namespace SourceGit.Views {
var rs = new Models.TextDiffSelection(); var rs = new Models.TextDiffSelection();
var diff = TextDiff; var diff = TextDiff;
endLine = Math.Min(endLine, TextDiff.Lines.Count);
if (Content is ViewModels.TwoSideTextDiff twoSides) { if (Content is ViewModels.TwoSideTextDiff twoSides) {
var target = isOldSide ? twoSides.Old : twoSides.New; var target = isOldSide ? twoSides.Old : twoSides.New;
var firstContentLine = -1; var firstContentLine = -1;