Fix crash when attacking city with disabled overlays (#8599)

Co-authored-by: tunerzinc@gmail.com <vfylfhby>
This commit is contained in:
vegeta1k95 2023-02-06 08:13:57 +01:00 committed by GitHub
parent c77ab71381
commit 8f56a88990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,11 @@ object BattleTableHelpers {
sequence {
val tileGroup = mapHolder.tileGroups[combatant.getTile()]!!
when {
combatant.isCity() -> yield(tileGroup.layerMisc.improvementIcon!!)
combatant.isCity() -> {
val icon = tileGroup.layerMisc.improvementIcon
if (icon != null)
yield(icon)
}
else -> {
val slot = if (combatant.isCivilian()) 0 else 1
yieldAll((tileGroup.layerUnitArt.getChild(slot) as Group).children)