mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
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:
@@ -2233,8 +2233,21 @@ namespace PepperDash.Essentials
|
|||||||
return;
|
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))
|
if (!_roomCombiner.CurrentScenario.UiMap.ContainsKey(roomKey))
|
||||||
{
|
{
|
||||||
|
|
||||||
this.LogWarning(
|
this.LogWarning(
|
||||||
"Unable to find correct roomKey for {roomKey} in current scenario. Returning {roomKey} as roomKey", roomKey);
|
"Unable to find correct roomKey for {roomKey} in current scenario. Returning {roomKey} as roomKey", roomKey);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user