From dae20d09dc1c368163a9372422df74df305414c8 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 29 Jul 2019 17:04:03 +0300 Subject: [PATCH] Fixed bug where if the AI completed all the policies and needed to pick another one, the game would crash --- core/src/com/unciv/logic/automation/NextTurnAutomation.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index 7a66f73124..5ce05fef6d 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -199,6 +199,10 @@ class NextTurnAutomation{ .flatMap { it.policies.union(listOf(it)) } .filter { civInfo.policies.isAdoptable(it) } + // This can happen if the player is crazy enough to have the game continue forever and he disabled cultural victory + if(adoptablePolicies.isEmpty()) return + + val preferredVictoryType = civInfo.victoryType() val policyBranchPriority = when(preferredVictoryType) {