diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 242f8c4c..757690e8 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1089,7 +1089,7 @@ namespace SourceGit.Views public void ForceSyncScrollOffset() { if (DataContext is ViewModels.TwoSideTextDiff diff) - diff.SyncScrollOffset = _scrollViewer.Offset; + diff.SyncScrollOffset = _scrollViewer?.Offset ?? Vector.Zero; } public override List GetLines() @@ -1302,7 +1302,7 @@ namespace SourceGit.Views private void OnTextViewScrollChanged(object sender, ScrollChangedEventArgs e) { if (TextArea.IsFocused && DataContext is ViewModels.TwoSideTextDiff diff) - diff.SyncScrollOffset = _scrollViewer.Offset; + diff.SyncScrollOffset = _scrollViewer?.Offset ?? Vector.Zero; } private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e)