diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 26aed977..ff8537f4 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1145,6 +1145,8 @@ namespace SourceGit.Views public void ForceSyncScrollOffset() { + if (_scrollViewer == null) + return; if (DataContext is ViewModels.TwoSideTextDiff diff) diff.SyncScrollOffset = _scrollViewer?.Offset ?? Vector.Zero; } @@ -1584,7 +1586,7 @@ namespace SourceGit.Views CurrentChangeBlockIdxProperty.Changed.AddClassHandler((v, e) => { - if (v.Editor.Presenter != null) + if ((int)e.NewValue >= 0 && v.Editor.Presenter != null) { foreach (var p in v.Editor.Presenter.GetVisualDescendants().OfType()) {