fix: Add null check for CurrentScenario in MobileControlSystem

This change introduces a check for `_roomCombiner.CurrentScenario` being `null`. When it is `null`, a `MobileControlMessage` is created with the type `/system/roomKey`, `clientId`, and `roomKey`, which is then sent to the client. This improves the handling of scenarios without a current scenario by ensuring relevant room key information is communicated.
This commit is contained in:
Neil Dorin
2025-09-30 12:11:25 -06:00
parent 5120b2b574
commit f91f435768

View File

@@ -2233,8 +2233,21 @@ namespace PepperDash.Essentials
return;
}
if (_roomCombiner.CurrentScenario == null)
{
var message = new MobileControlMessage
{
Type = "/system/roomKey",
ClientId = clientId,
Content = roomKey
};
SendMessageObject(message);
return;
}
if (!_roomCombiner.CurrentScenario.UiMap.ContainsKey(roomKey))
{
this.LogWarning(
"Unable to find correct roomKey for {roomKey} in current scenario. Returning {roomKey} as roomKey", roomKey);