diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs index 660a9f23..69deff05 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs @@ -423,19 +423,22 @@ namespace Myshipping.Application await _serviceWorkFlowActivitiesSubRelationRepository.InsertAsync(wfRelationActivitiesSub); - sub.StatusTriggerList.ForEach(async trg => + if (sub != null && sub.StatusTriggerList != null && sub.StatusTriggerList.Count > 0) { - var triggerRela = new ServiceWorkFlowActivitiesTriggerRelation + sub.StatusTriggerList.ForEach(async trg => { - PK_ID = IDGen.NextID().ToString(), - SERVICE_WORKFLOW_ID = entity.PK_ID, - SERVICE_ACTIVITIES_ID = sub.PKId, - STATUS_TRIGGER_ID = trg.PKId, - WF_VERSION = currVersion - }; + var triggerRela = new ServiceWorkFlowActivitiesTriggerRelation + { + PK_ID = IDGen.NextID().ToString(), + SERVICE_WORKFLOW_ID = entity.PK_ID, + SERVICE_ACTIVITIES_ID = sub.PKId, + STATUS_TRIGGER_ID = trg.PKId, + WF_VERSION = currVersion + }; - await _serviceWorkFlowActivitiesTriggerRelationRepository.InsertAsync(triggerRela); - }); + await _serviceWorkFlowActivitiesTriggerRelationRepository.InsertAsync(triggerRela); + }); + } }); }