fix(GameManager): give a default value to lastState just in case

This commit is contained in:
Fangh 2024-02-29 22:45:37 +01:00
parent d9580450cc
commit 24c001dcc7

View File

@ -297,6 +297,8 @@ public void StartGame()
/// </summary>
private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{
GameState lastState = myRoom != null ? (GameState)myRoom.currentState : GameState.EnteringName;
try
{
if (e?.Snapshot?.GetRawJsonValue() != null)
@ -316,7 +318,6 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
return;
}
GameState lastState = (GameState)myRoom.currentState;
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
if (myRoom.currentState != (int)lastState)