Skip to content

Commit

Permalink
Merge pull request #106 from LukeOrdelmans/bugfix/fix-null-reference-…
Browse files Browse the repository at this point in the history
…on-disconnected-treenode

Fixed a NullReferenceException caused by handling a left mouse click on a child node
  • Loading branch information
jogibear9988 committed May 23, 2023
2 parents 4f44439 + 92292dc commit 0dfcaeb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ public override bool ShouldItemBeVisible(DragTreeViewItem dragTreeViewitem)
protected override void SelectOnly(DragTreeViewItem item)
{
base.SelectOnly(item);

var node = item.DataContext as IOutlineNode;

if (node.DesignItem != null) {
if (item.DataContext is IOutlineNode node && node.DesignItem != null) {
var surface = node.DesignItem.View.TryFindParent<DesignSurface>();
if (surface != null)
surface.ScrollIntoView(node.DesignItem);
Expand Down

0 comments on commit 0dfcaeb

Please sign in to comment.