mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-06 17:18:11 +07:00
Resolved crash when returning to empire overview and a category is missing
This commit is contained in:
parent
62469daff6
commit
626973bfb7
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user