From 314b620405d41364b1e1912c48d47461af208496 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 22 Dec 2019 18:35:41 +0200 Subject: [PATCH] Fixed relatively rare crash where the settings were being read but ended up null, not sure how that happened to start with... --- core/src/com/unciv/logic/GameSaver.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/GameSaver.kt b/core/src/com/unciv/logic/GameSaver.kt index adacae0196..43a0aeeaf3 100644 --- a/core/src/com/unciv/logic/GameSaver.kt +++ b/core/src/com/unciv/logic/GameSaver.kt @@ -48,7 +48,10 @@ class GameSaver { fun getGeneralSettings(): GameSettings { val settingsFile = getGeneralSettingsFile() if(!settingsFile.exists()) return GameSettings() - val settings = json().fromJson(GameSettings::class.java, settingsFile) + var settings = json().fromJson(GameSettings::class.java, settingsFile) + // I'm not sure of the circumstances, + // but some people were getting null settings, even though the file existed??? Very odd. + if(settings==null) settings = GameSettings() val currentTileSets = ImageGetter.atlas.regions.asSequence() .filter { it.name.startsWith("TileSets") }