Added safeguards for edge cases

This commit is contained in:
goran-w 2024-11-17 22:41:25 +01:00
parent aeea77078b
commit 11a02343a0

View file

@ -1145,6 +1145,8 @@ namespace SourceGit.Views
public void ForceSyncScrollOffset()
{
if (_scrollViewer == null)
return;
if (DataContext is ViewModels.TwoSideTextDiff diff)
diff.SyncScrollOffset = _scrollViewer.Offset;
}
@ -1584,7 +1586,7 @@ namespace SourceGit.Views
CurrentChangeBlockIdxProperty.Changed.AddClassHandler<TextDiffView>((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<ThemedTextDiffPresenter>())
{