diff --git a/bsmd.hisnord/Request.cs b/bsmd.hisnord/Request.cs index 3f35fa19..2fc60616 100644 --- a/bsmd.hisnord/Request.cs +++ b/bsmd.hisnord/Request.cs @@ -85,6 +85,18 @@ namespace bsmd.hisnord bool? retval; try { + if (core == null) + { + _log.ErrorFormat("CreateSendFile called with null core"); + return false; + } + + if (!core.Id.HasValue) + { + _log.ErrorFormat("CreateSendFile called with core that has no Id assigned"); + return false; + } + nsw _nsw = new nsw(); _nsw.conveyance = new conveyance(); @@ -121,8 +133,9 @@ namespace bsmd.hisnord _nsw.conveyance.owner_sender.contact.phone = rp.Phone; _nsw.conveyance.owner_sender.contact.fax = rp.Fax; - _nsw.document_reference = core.Id.Value.ToString(); - _nsw.conveyance.code = core.Id.ToString(); + Guid coreId = core.Id.Value; + _nsw.document_reference = coreId.ToString(); + _nsw.conveyance.code = coreId.ToString(); if (!core.VisitId.IsNullOrEmpty()) {