From e314f580351f07c8bd03968a57c9766c8360ae3e Mon Sep 17 00:00:00 2001 From: jtalborough Date: Thu, 27 Feb 2025 11:17:07 -0500 Subject: [PATCH] fix: add null check for room before adding to DeviceManager --- src/PepperDash.Essentials/ControlSystem.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index d93d9a89..5007bf2c 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -471,7 +471,16 @@ namespace PepperDash.Essentials { var room = Core.DeviceFactory.GetDevice(roomConfig); - DeviceManager.AddDevice(room); + if(room == null) + { + Debug.LogMessage(LogEventLevel.Information, "ERROR: Cannot load unknown room type '{roomType:l}', key '{roomKey:l}'.", roomConfig.Type, roomConfig.Key); + continue; + } + else + { + DeviceManager.AddDevice(room); + } + if (room is ICustomMobileControl) { continue;