From f7a1633c3346240287d768109840838cee2a8fc0 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 15 Nov 2020 20:38:52 +0200 Subject: [PATCH] Probably solved the Mysterious Disappearing C's this time for realz! #3327 --- core/src/com/unciv/MainMenuScreen.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/MainMenuScreen.kt b/core/src/com/unciv/MainMenuScreen.kt index 38e503cc04..962543dac0 100644 --- a/core/src/com/unciv/MainMenuScreen.kt +++ b/core/src/com/unciv/MainMenuScreen.kt @@ -171,14 +171,15 @@ class MainMenuScreen: CameraStageBaseScreen() { try { savedGame = GameSaver.loadGameByName(autosave) } catch (outOfMemory: OutOfMemoryError) { - ToastPopup("Not enough memory on phone to load game!", this) + Gdx.app.postRunnable { ToastPopup("Not enough memory on phone to load game!", this) } return@thread } catch (ex: Exception) { // silent fail if we can't read the autosave for any reason - try to load the last autosave by turn number first + // This can help for situations when the autosave is corrupted try { val autosaves = GameSaver.getSaves().filter { it.name() != autosave && it.name().startsWith(autosave) } savedGame = GameSaver.loadGameFromFile(autosaves.maxBy { it.lastModified() }!!) } catch (ex: Exception) { - ToastPopup("Cannot resume game!", this) + Gdx.app.postRunnable { ToastPopup("Cannot resume game!", this) } return@thread } }