From c7b1121fe4d61c9eb998889d2972c4058f44fcff Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 19 Oct 2020 23:24:53 +0300 Subject: [PATCH] Resolved another crash caused by incorrect ruleset mod definitions --- core/src/com/unciv/models/ruleset/Nation.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/Nation.kt b/core/src/com/unciv/models/ruleset/Nation.kt index bdf298456b..829656c4be 100644 --- a/core/src/com/unciv/models/ruleset/Nation.kt +++ b/core/src/com/unciv/models/ruleset/Nation.kt @@ -115,8 +115,7 @@ class Nation : INamed { private fun addUniqueBuildingsText(textList: ArrayList, ruleset: Ruleset) { for (building in ruleset.buildings.values .filter { it.uniqueTo == name && "Will not be displayed in Civilopedia" !in it.uniques}) { - if (building.replaces == null) textList += building.getShortDescription(ruleset) - else { + if (building.replaces != null && ruleset.buildings.containsKey(building.replaces!!)) { val originalBuilding = ruleset.buildings[building.replaces!!]!! textList += building.name.tr() + " - " + "Replaces [${originalBuilding.name}]".tr() @@ -136,7 +135,9 @@ class Nation : INamed { if (building.cityHealth != originalBuilding.cityHealth) textList += " {City health} " + "[${building.cityHealth}] vs [${originalBuilding.cityHealth}]".tr() textList += "" - } + } else if (building.replaces != null) { + textList += building.name.tr() + " - " + "Replaces [${building.replaces}], which is not found in the ruleset!".tr() + } else textList += building.getShortDescription(ruleset) } }