From 0519b926717e09675b93ec526d8a59a8c1bf9395 Mon Sep 17 00:00:00 2001 From: CrispyXYZ <64761703+CrispyXYZ@users.noreply.github.com> Date: Wed, 28 Dec 2022 17:23:55 +0800 Subject: [PATCH] Check non-null when removing road (fix #8249) (#8250) --- core/src/com/unciv/logic/map/TileInfo.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index fc63a806d0..b6c3e522db 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -306,10 +306,11 @@ open class TileInfo : IsPartOfGameInfoSerialization { // function handling when removing a road from the tile fun removeRoad() { - roadStatus = RoadStatus.None roadIsPillaged = false + if (roadStatus == RoadStatus.None) return + roadStatus = RoadStatus.None if (owningCity == null) - getRoadOwner()!!.neutralRoads.remove(this.position) + getRoadOwner()?.neutralRoads?.remove(this.position) } fun getShownImprovement(viewingCiv: CivilizationInfo?): String? {