From 8457c7ab1d9074f9cf1663607b31b44562ebf003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=BCnther?= Date: Sat, 16 Apr 2022 22:06:07 +0200 Subject: [PATCH] Fixed TurnChecker crash when using custom server (#6554) --- core/src/com/unciv/logic/multiplayer/SimpleHttp.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/multiplayer/SimpleHttp.kt b/core/src/com/unciv/logic/multiplayer/SimpleHttp.kt index 3227335348..48b6b32b5f 100644 --- a/core/src/com/unciv/logic/multiplayer/SimpleHttp.kt +++ b/core/src/com/unciv/logic/multiplayer/SimpleHttp.kt @@ -27,7 +27,10 @@ object SimpleHttp { with(urlObj.openConnection() as HttpURLConnection) { requestMethod = method // default is GET - setRequestProperty("User-Agent", "Unciv/${UncivGame.Current.version}-GNU-Terry-Pratchett") + if (UncivGame.isCurrentInitialized()) + setRequestProperty("User-Agent", "Unciv/${UncivGame.Current.version}-GNU-Terry-Pratchett") + else + setRequestProperty("User-Agent", "Unciv/Turn-Checker-GNU-Terry-Pratchett") try { if (content.isNotEmpty()) {