mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +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:
parent
5120b2b574
commit
f91f435768
1 changed files with 13 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue