mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix<Diff>: fix crash when diff line is empty
This commit is contained in:
parent
8191758a97
commit
fe3a36348e
1 changed files with 7 additions and 0 deletions
|
@ -36,6 +36,13 @@ namespace SourceGit.Commands {
|
||||||
newLine = int.Parse(match.Groups[2].Value);
|
newLine = int.Parse(match.Groups[2].Value);
|
||||||
changes.Lines.Add(new Models.TextChanges.Line(Models.TextChanges.LineMode.Indicator, line, "", ""));
|
changes.Lines.Add(new Models.TextChanges.Line(Models.TextChanges.LineMode.Indicator, line, "", ""));
|
||||||
} else {
|
} else {
|
||||||
|
if (line.Length == 0) {
|
||||||
|
changes.Lines.Add(new Models.TextChanges.Line(Models.TextChanges.LineMode.Normal, "", $"{oldLine}", $"{newLine}"));
|
||||||
|
oldLine++;
|
||||||
|
newLine++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var ch = line[0];
|
var ch = line[0];
|
||||||
if (ch == '-') {
|
if (ch == '-') {
|
||||||
changes.Lines.Add(new Models.TextChanges.Line(Models.TextChanges.LineMode.Deleted, line.Substring(1), $"{oldLine}", ""));
|
changes.Lines.Add(new Models.TextChanges.Line(Models.TextChanges.LineMode.Deleted, line.Substring(1), $"{oldLine}", ""));
|
||||||
|
|
Loading…
Reference in a new issue