From 78c02df317a750aeade33896b9f33e12cc285efe Mon Sep 17 00:00:00 2001 From: yairm210 Date: Tue, 19 Nov 2024 08:55:49 +0200 Subject: [PATCH] Avoid ANR errors when attempting to start a MP game when server takes too long to respond --- .../com/unciv/ui/screens/newgamescreen/NewGameScreen.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt index 09a90a7bf8..7b5744e660 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt @@ -113,9 +113,11 @@ class NewGameScreen( private fun startGameAvoidANRs(){ // Don't allow players to click the game while we're checking if it's ok Gdx.input.inputProcessor = null - val success = startGame() - // if it is successful, the player should wait for the new screen, not touch the old one - if (!success) Gdx.input.inputProcessor = stage + Concurrency.run { // even just *checking* can take time + val success = startGame() + // if it is successful, the player should wait for the new screen, not touch the old one + if (!success) Gdx.input.inputProcessor = stage + } } private fun startGame(): Boolean {