B2017-065 Fixed null reference bug happening during a CopyStep / Replace Step of an EOP step that is linked to an Enhanced step

This commit is contained in:
John Jenko 2017-03-29 16:51:15 +00:00
parent 3935e16f46
commit 75ec77fd49

View File

@ -544,8 +544,9 @@ namespace VEPROMS.CSLA.Library
public static void CheckSourceDestinationType(int copyStartID, ItemInfo itemInfo) public static void CheckSourceDestinationType(int copyStartID, ItemInfo itemInfo)
{ {
ItemInfo cpyItem = ItemInfo.Get(copyStartID); ItemInfo cpyItem = ItemInfo.Get(copyStartID);
int? SourceType = cpyItem._MyContent.Type; // B2017-065 use MyContent instead of _Mycontent so that if null it will get the needed content
int? DestType = itemInfo._MyContent.Type; int? SourceType = cpyItem.MyContent.Type;
int? DestType = itemInfo.MyContent.Type;
if (DestType >= 20000 && DestType != SourceType) if (DestType >= 20000 && DestType != SourceType)
{ {
string msg = "The step you are copying TO is a different type than the step you are copying FROM.\n\nThe copied step will inherit the destination step type.\n\nOnce copied, the step type can be changed from the Tags tab on the Step Properties panel."; string msg = "The step you are copying TO is a different type than the step you are copying FROM.\n\nThe copied step will inherit the destination step type.\n\nOnce copied, the step type can be changed from the Tags tab on the Step Properties panel.";
@ -1278,7 +1279,7 @@ namespace VEPROMS.CSLA.Library
// don't connect back, so find one that does based on Enhance HLS note list & // don't connect back, so find one that does based on Enhance HLS note list &
// the notes' links back to source. // the notes' links back to source.
ItemInfo enhNtItem = null; ItemInfo enhNtItem = null;
while (enhNtItem == null && enhIndxNt < enhHls.Notes.Count) while (enhNtItem == null && enhHls.Notes != null && enhIndxNt < enhHls.Notes.Count) // B2017-065 added a null check for Notes
{ {
ItemInfo enhTstNote = enhHls.Notes[enhIndxNt]; ItemInfo enhTstNote = enhHls.Notes[enhIndxNt];
StepConfig enhTstNoteCfg = enhTstNote.MyConfig as StepConfig; StepConfig enhTstNoteCfg = enhTstNote.MyConfig as StepConfig;