Browse Source

Fix for crash in SharpTreeView.flattener_CollectionChanged() when no items can be selected.

pull/80/head
Andreas Weizel 13 years ago
parent
commit
670087f732
  1. 3
      src/Libraries/SharpTreeView/ICSharpCode.TreeView/SharpTreeView.cs

3
src/Libraries/SharpTreeView/ICSharpCode.TreeView/SharpTreeView.cs

@ -155,7 +155,8 @@ namespace ICSharpCode.TreeView
// if we removed all selected nodes, then move the focus to the node // if we removed all selected nodes, then move the focus to the node
// preceding the first of the old selected nodes // preceding the first of the old selected nodes
SelectedIndex = Math.Max(0, e.OldStartingIndex - 1); SelectedIndex = Math.Max(0, e.OldStartingIndex - 1);
FocusNode((SharpTreeNode)SelectedItem); if (SelectedIndex >= 0)
FocusNode((SharpTreeNode)SelectedItem);
} }
} }
} }

Loading…
Cancel
Save