diff --git a/client/Assets/Scripts/Battle/BattleManager.cs b/client/Assets/Scripts/Battle/BattleManager.cs index f2bf1e5d..111f7032 100644 --- a/client/Assets/Scripts/Battle/BattleManager.cs +++ b/client/Assets/Scripts/Battle/BattleManager.cs @@ -227,7 +227,7 @@ private void HandleBattleResult(bool result) // This should be handled differently CampaignManager.selectedCampaignData.levels.Find(level => level.id == LevelProgress.selectedLevelData.id).status = LevelProgress.Status.Completed; - if (CampaignManager.selectedCampaignData.levels.Any(level => level.id == LevelProgress.nextLevelData.id)) + if (LevelProgress.nextLevelData != null && CampaignManager.selectedCampaignData.levels.Any(level => level.id == LevelProgress.nextLevelData.id)) { CampaignManager.selectedCampaignData.levels.Find(level => level.id == LevelProgress.nextLevelData.id).status = LevelProgress.Status.Unlocked; } @@ -318,6 +318,12 @@ private Dictionary GetLevelRewards() private void SetUpNextButton() { GameObject nextButton = victorySplash.transform.Find("Next").gameObject; + if (LevelProgress.nextLevelData == null) + { + nextButton.SetActive(false); + return; + } + else if (LevelProgress.selectedLevelData.campaignId != LevelProgress.nextLevelData.campaignId) { nextButton.GetComponentInChildren().text = "NEXT CAMPAIGN";