From fdc7f6af4941690a3bc7852d09394e7d87bd4c23 Mon Sep 17 00:00:00 2001 From: Dirkster99 Date: Sat, 5 Oct 2019 22:45:06 +0200 Subject: [PATCH] Fix NullReferenceException on _model & _model.SelectedContent in LayoutAnchorablePaneControl --- .../Controls/LayoutAnchorablePaneControl.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs b/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs index 97f7ec31..f543d9fa 100644 --- a/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs +++ b/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs @@ -70,7 +70,10 @@ public ILayoutElement Model protected override void OnGotKeyboardFocus( System.Windows.Input.KeyboardFocusChangedEventArgs e ) { - _model.SelectedContent.IsActive = true; + if( ( _model != null ) && ( _model.SelectedContent != null ) ) + { + _model.SelectedContent.IsActive = true; + } base.OnGotKeyboardFocus( e ); } @@ -79,7 +82,7 @@ protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonE { base.OnMouseLeftButtonDown( e ); - if( !e.Handled && _model.SelectedContent != null ) + if( !e.Handled && (_model != null) && _model.SelectedContent != null ) _model.SelectedContent.IsActive = true; } @@ -87,7 +90,7 @@ protected override void OnMouseRightButtonDown( System.Windows.Input.MouseButton { base.OnMouseRightButtonDown( e ); - if( !e.Handled && _model.SelectedContent != null ) + if( !e.Handled && (_model != null) && _model.SelectedContent != null ) _model.SelectedContent.IsActive = true; }