From 196111b8366f3a49d25d999f95b9c875e0e3092d Mon Sep 17 00:00:00 2001 From: John Date: Mon, 25 Nov 2013 17:56:50 +0000 Subject: [PATCH] handle NULL reference exception --- PROMS/DataLoader/Transitions.cs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/PROMS/DataLoader/Transitions.cs b/PROMS/DataLoader/Transitions.cs index df6b045d..c683103b 100644 --- a/PROMS/DataLoader/Transitions.cs +++ b/PROMS/DataLoader/Transitions.cs @@ -355,17 +355,19 @@ namespace DataLoader break; } } - - // For each transition that points to the A0, make it point to the proc. - // First, find all of them by getting transitions with the A0 (dummy - // transition record). Then update the to or range id in the transition - // record & then update the content/from part. - List transToChg = new List(); - List transRgChg = new List(); - TransitionInfoList til = TransitionInfoList.GetByToID(item.ItemID); - foreach (TransitionInfo ti in til) UpdateTranDataForA0(prc, ti.TransitionID, false); - til = TransitionInfoList.GetByRangeID(item.ItemID); - foreach (TransitionInfo tir in til) UpdateTranDataForA0(prc, tir.TransitionID, true); + if (prc != null) + { + // For each transition that points to the A0, make it point to the proc. + // First, find all of them by getting transitions with the A0 (dummy + // transition record). Then update the to or range id in the transition + // record & then update the content/from part. + List transToChg = new List(); + List transRgChg = new List(); + TransitionInfoList til = TransitionInfoList.GetByToID(item.ItemID); + foreach (TransitionInfo ti in til) UpdateTranDataForA0(prc, ti.TransitionID, false); + til = TransitionInfoList.GetByRangeID(item.ItemID); + foreach (TransitionInfo tir in til) UpdateTranDataForA0(prc, tir.TransitionID, true); + } } } foreach (string str in RemoveFromDicTrans)