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)