Bug Fix - If a node doesn't have a parent, the program will not crash

This commit is contained in:
Rich 2010-01-08 14:29:08 +00:00
parent 7ab1302c84
commit 147dd8919c

View File

@ -341,11 +341,13 @@ namespace VEPROMS.CSLA.Library
} }
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args) void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
{ {
if(this.Parent != null) // Only do this if the node has a parent - RHM 20100106
this.Parent.Nodes.Insert(Index,(new VETreeNode(args.ItemInserted))); this.Parent.Nodes.Insert(Index,(new VETreeNode(args.ItemInserted)));
} }
void myItemInfo_NewSiblingAfter(object sender, ItemInfoInsertEventArgs args) void myItemInfo_NewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
{ {
this.Parent.Nodes.Insert(Index+1, (new VETreeNode(args.ItemInserted))); if (this.Parent != null) // Only do this if the node has a parent - RHM 20100106
this.Parent.Nodes.Insert(Index + 1, (new VETreeNode(args.ItemInserted)));
} }
void MyContent_Changed(object sender) void MyContent_Changed(object sender)
{ {