Added extra verification to catch a maybe very rare error

This commit is contained in:
Daniel Schick 2025-11-10 17:00:08 +01:00
parent a3d6ed337a
commit 4257fdbea0

View File

@ -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())
{