From 190abc72dd4f8593db7eaa5b019417d3c0bd6a84 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 9 Feb 2023 20:03:20 +1100 Subject: [PATCH] bug: when adding computer offline, computer name should not be required --- Disco.Web/Controllers/DeviceController.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Disco.Web/Controllers/DeviceController.cs b/Disco.Web/Controllers/DeviceController.cs index 01c71ef9..cea6a428 100644 --- a/Disco.Web/Controllers/DeviceController.cs +++ b/Disco.Web/Controllers/DeviceController.cs @@ -80,13 +80,16 @@ namespace Disco.Web.Controllers } if (string.IsNullOrWhiteSpace(m.Device.DeviceDomainId)) m.Device.DeviceDomainId = null; - try + if (m.Device.DeviceDomainId != null) { - m.Device.DeviceDomainId = ActiveDirectory.ParseDomainAccountId(m.Device.DeviceDomainId); - } - catch (ArgumentException ex) - { - ModelState.AddModelError("Device.DeviceDomainId", ex.Message); + try + { + m.Device.DeviceDomainId = ActiveDirectory.ParseDomainAccountId(m.Device.DeviceDomainId); + } + catch (ArgumentException ex) + { + ModelState.AddModelError("Device.DeviceDomainId", ex.Message); + } } if (ModelState.IsValid)