Application crash after the defeat (#2427)

This commit is contained in:
Jack Rainy 2020-04-16 16:15:47 +03:00 committed by GitHub
parent 25b1259ab6
commit 038e1cadbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -307,7 +307,7 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
fun setCenterPosition(vector: Vector2, immediately: Boolean = false, selectUnit: Boolean = true) {
val tileGroup = tileGroups.values.first { it.tileInfo.position == vector }
val tileGroup = tileGroups.values.firstOrNull { it.tileInfo.position == vector } ?: return
selectedTile = tileGroup.tileInfo
if(selectUnit)
worldScreen.bottomUnitTable.tileSelected(selectedTile!!)

View file

@ -244,7 +244,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
displayTutorialsOnUpdate()
bottomUnitTable.update()
bottomTileInfoTable.updateTileTable(mapHolder.selectedTile!!)
bottomTileInfoTable.updateTileTable(mapHolder.selectedTile)
bottomTileInfoTable.x = stage.width - bottomTileInfoTable.width
bottomTileInfoTable.y = if (UncivGame.Current.settings.showMinimap) minimapWrapper.height else 0f
battleTable.update()

View file

@ -15,10 +15,10 @@ class TileInfoTable(private val viewingCiv :CivilizationInfo) : Table(CameraStag
background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
}
internal fun updateTileTable(tile: TileInfo) {
internal fun updateTileTable(tile: TileInfo?) {
clearChildren()
if (UncivGame.Current.viewEntireMapForDebug || viewingCiv.exploredTiles.contains(tile.position)) {
if ((tile != null) && (UncivGame.Current.viewEntireMapForDebug || viewingCiv.exploredTiles.contains(tile.position))) {
add(getStatsTable(tile))
add(tile.toString(viewingCiv).toLabel()).colspan(2).pad(10f)
}