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
1 changed files with 2 additions and 1 deletions

View File

@ -297,6 +297,8 @@ public class GameManager : MonoBehaviour
/// </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 @@ public class GameManager : MonoBehaviour
return;
}
GameState lastState = (GameState)myRoom.currentState;
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
if (myRoom.currentState != (int)lastState)