Not being able to read the settings file shouldn't make you crash

Happened to 2 users out of almost 400K, but it's an easy fix so why not help the 0.005%
This commit is contained in:
Yair Morgenstern 2020-04-03 10:28:49 +03:00
parent 0289af28ce
commit 8f583732aa

View file

@ -55,7 +55,11 @@ class GameSaver {
fun getGeneralSettings(): GameSettings {
val settingsFile = getGeneralSettingsFile()
if(!settingsFile.exists()) return GameSettings()
var settings = json().fromJson(GameSettings::class.java, settingsFile)
var settings: GameSettings?=null
try {
settings = json().fromJson(GameSettings::class.java, settingsFile)
}
catch (ex:Exception){}
// 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()