fixed crash (#3077)

This commit is contained in:
HadeanLake 2020-09-02 10:36:34 +03:00 committed by GitHub
parent 6d190d1097
commit 0335b3ba46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,8 +146,10 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
mapFileSelectBox.items = mapFiles
val selectedItem = mapFiles.firstOrNull { it.fileHandle.name()==mapParameters.name }
if (selectedItem != null) mapFileSelectBox.selected = selectedItem
else mapFileSelectBox.selected = mapFiles.first()
newGameScreen.gameSetupInfo.mapFile = mapFileSelectBox.selected.fileHandle
else if (!mapFiles.isEmpty) {
mapFileSelectBox.selected = mapFiles.first()
newGameScreen.gameSetupInfo.mapFile = mapFileSelectBox.selected.fileHandle
}
mapFileSelectBox.onChange {
val mapFile = mapFileSelectBox.selected.fileHandle