Fixed TurnChecker crash when using custom server (#6554)

This commit is contained in:
Leonard Günther 2022-04-16 22:06:07 +02:00 committed by GitHub
parent 7ced78f6a2
commit 8457c7ab1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()) {