NullRefFix: Gameplay.

While selecting PvsAI and selecting green, got a null ref due to wrong currentPlayerTurnIndex be passed on.
This commit is contained in:
Ashby Issac 2026-02-23 16:09:23 +05:30
parent e560024e70
commit 66c71eb098
2 changed files with 5 additions and 3 deletions

View File

@ -264,7 +264,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
// SetCanRollDiceForUser(!isBotTurn); // TODO :: Need to change
if (isBotTurn)
{
currentPlayerTurnTimer.KillTimer();
currentPlayerTurnTimer?.KillTimer();
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
return;
}
@ -302,11 +302,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void ResetCurrentPlayerTurnTimer()
{
currentPlayerTurnTimer.KillTimer();
currentPlayerTurnTimer?.KillTimer();
}
public void InitCurrentGamePlayerInfo()
{
currentPlayerTurnIndex = 0;
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
SetCanRollDiceForUser(IsUsersTurn());
UpdateDiceView();

View File

@ -56,6 +56,7 @@ public class PlayerBaseHandler : MonoBehaviour
public void ShowSelectedPlayerBase(PlayerType playerType, bool state)
{
playerBasesDict[playerType].ShowPlayerBaseEffect(state);
if (playerBasesDict.ContainsKey(playerType))
playerBasesDict[playerType].ShowPlayerBaseEffect(state);
}
}