From e8e0704267b043a2bfaef75a6c2dda2bbf5528f8 Mon Sep 17 00:00:00 2001 From: iadgovuser59 <133057011+iadgovuser59@users.noreply.github.com> Date: Wed, 7 Aug 2024 22:56:36 -0400 Subject: [PATCH] Check for hardware info --- .../hirs/src/provisioner/Provisioner.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/HIRS_Provisioner.NET/hirs/src/provisioner/Provisioner.cs b/HIRS_Provisioner.NET/hirs/src/provisioner/Provisioner.cs index 2d47ed48e..587d94f7d 100644 --- a/HIRS_Provisioner.NET/hirs/src/provisioner/Provisioner.cs +++ b/HIRS_Provisioner.NET/hirs/src/provisioner/Provisioner.cs @@ -129,11 +129,13 @@ public void SetDeviceInfoCollector(IHirsDeviceInfoCollector collector) { public static string FormatCertificatePath(DeviceInfo dv, string certificateDirPath, string certificateFileName) { StringBuilder sb = new StringBuilder(); sb.Append(certificateDirPath); - if (dv.Hw.HasSystemSerialNumber && !dv.Hw.SystemSerialNumber.Equals(ClassicDeviceInfoCollector.NOT_SPECIFIED)) { - sb.AppendFormat("{0}-", dv.Hw.SystemSerialNumber); - } - if (dv.Hw.HasManufacturer && !dv.Hw.Manufacturer.Equals(ClassicDeviceInfoCollector.NOT_SPECIFIED)) { - sb.AppendFormat("{0}-", dv.Hw.Manufacturer); + if (dv?.Hw != null) { + if (dv.Hw.HasSystemSerialNumber && !dv.Hw.SystemSerialNumber.Equals(ClassicDeviceInfoCollector.NOT_SPECIFIED)) { + sb.AppendFormat("{0}-", dv.Hw.SystemSerialNumber); + } + if (dv.Hw.HasManufacturer && !dv.Hw.Manufacturer.Equals(ClassicDeviceInfoCollector.NOT_SPECIFIED)) { + sb.AppendFormat("{0}-", dv.Hw.Manufacturer); + } } sb.Append(certificateFileName); return sb.ToString();