diff --git a/core/src/com/unciv/ui/screens/overviewscreen/EmpireOverviewScreen.kt b/core/src/com/unciv/ui/screens/overviewscreen/EmpireOverviewScreen.kt index e9420e1843..effa1644e6 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/EmpireOverviewScreen.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/EmpireOverviewScreen.kt @@ -116,7 +116,7 @@ class EmpireOverviewScreen( // This is called by UncivGame.popScreen - e.g. after City Tab opened a City and the user closes that CityScreen... // Notify the current tab via its IPageExtensions.activated entry point so it can refresh if needed val index = tabbedPager.activePage - val category = EmpireOverviewCategories.values()[index - 1] + val category = EmpireOverviewCategories.values().getOrNull(index - 1) ?: return pageObjects[category]?.activated(index, "", tabbedPager) // Fake caption marks this as popScreen-triggered } } diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt index 5fd1bf10f4..68515e2d70 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt @@ -24,7 +24,7 @@ object UnitActions { /** Returns whether the action was invoked */ fun invokeUnitAction(unit: MapUnit, unitActionType: UnitActionType): Boolean { val unitAction = if (unitActionType in actionTypeToFunctions) actionTypeToFunctions[unitActionType]!!.invoke(unit, unit.getTile()) - .firstOrNull{ it.action != null } + .firstOrNull { it.action != null } else getNormalActions(unit).firstOrNull { it.type == unitActionType && it.action != null } ?: getAdditionalActions(unit).firstOrNull { it.type == unitActionType && it.action != null } val internalAction = unitAction?.action ?: return false