From 2a3a0b107fb3bcd857d4fd4322b335bf74c3074b Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 2 Dec 2020 23:17:20 +0200 Subject: [PATCH] Fixed rare errors --- core/src/com/unciv/ui/utils/ToastPopup.kt | 3 ++- core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/utils/ToastPopup.kt b/core/src/com/unciv/ui/utils/ToastPopup.kt index 981f134232..8978714fcc 100644 --- a/core/src/com/unciv/ui/utils/ToastPopup.kt +++ b/core/src/com/unciv/ui/utils/ToastPopup.kt @@ -1,5 +1,6 @@ package com.unciv.ui.utils +import com.badlogic.gdx.Gdx import kotlin.concurrent.thread //Its a popUp which will close itself after a given amount of time @@ -17,7 +18,7 @@ class ToastPopup (message: String, screen: CameraStageBaseScreen, time: Long = 1 private fun startTimer(){ thread (name = "ResponsePopup") { Thread.sleep(visibilityTime) - this.close() + Gdx.app.postRunnable { this.close() } } } diff --git a/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt b/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt index 848f255e4a..c42ef1d288 100644 --- a/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt +++ b/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt @@ -42,6 +42,11 @@ object DropBox { val reader = BufferedReader(InputStreamReader(errorStream)) println(reader.readText()) return null + } catch (error: Error) { + println(error.message) + val reader = BufferedReader(InputStreamReader(errorStream)) + println(reader.readText()) + return null } } }