diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index eda53404..c5016175 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1823,7 +1823,7 @@ namespace Volian.Controls.Library { // To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field // to simulate replacing an existing step - otherwise we will get null references. - if (MyStepPanel.SelectedEditItem.Empty) + if (MyStepPanel.SelectedEditItem != null && MyStepPanel.SelectedEditItem.Empty) MyStepPanel.SelectedEditItem.Empty = false; MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted ChildRelation childRelation = _MyChildRelation; @@ -1837,9 +1837,17 @@ namespace Volian.Controls.Library int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top)); int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top)); ItemInfo newItemInfo = null; + bool gotoFirstTrans = false; try { - newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo)); + newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans); + if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved + { + MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo); + return null; + } + if (newItemInfo == null) + return this; // aborted the replace so just return to the step we were trying to replace } //catch (System.Data.SqlClient.SqlException ex) catch (Exception ex) @@ -1850,7 +1858,6 @@ namespace Volian.Controls.Library } // Remove the EditItem that was the replaced item. RemoveFromParentsChildList(); - if (MyNextEditItem != null) { if (MyPreviousEditItem != null) diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index a412f8d5..cf67db8e 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -3569,7 +3569,8 @@ namespace Volian.Controls.Library if (tmp.MyDisplayTabControl.MyCopyStep == null) return; EditItem oldEditItem = MyEditItem; MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID); - if (MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose(); + if (MyEditItem == null) oldEditItem.IdentifyMe(false); // B2017-179 if null then we didn't do the replace but did position to the first transition that needs resolved + if (MyEditItem != null && MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose(); } private void btnPdfCreate_Click(object sender, EventArgs e)