mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-08 01:54:02 +07:00
Bug Fix for Multiplayer Screen (#1970)
* Possible Bug Fix Testing if clipboard content == null This should have been a problem before * Moved null check into addMultiplayerGame making it more readable
This commit is contained in:
parent
cf84f5a0b5
commit
8733f02f85
@ -111,14 +111,11 @@ class MultiplayerScreen() : PickerScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Adds a new Multiplayer game to the List
|
//Adds a new Multiplayer game to the List
|
||||||
fun addMultiplayerGame(gameId: String, gameName: String = ""){
|
//gameId must be nullable because clipboard content could be null
|
||||||
if (gameIsAlreadySavedAsMultiplayer(gameId)) {
|
fun addMultiplayerGame(gameId: String?, gameName: String = ""){
|
||||||
ResponsePopup("Game is already added".tr(), this)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
//since the gameId is a String it can contain anything and has to be checked
|
//since the gameId is a String it can contain anything and has to be checked
|
||||||
UUID.fromString(gameId.trim())
|
UUID.fromString(gameId!!.trim())
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
val errorPopup = Popup(this)
|
val errorPopup = Popup(this)
|
||||||
errorPopup.addGoodSizedLabel("Invalid game ID!".tr())
|
errorPopup.addGoodSizedLabel("Invalid game ID!".tr())
|
||||||
@ -127,6 +124,12 @@ class MultiplayerScreen() : PickerScreen() {
|
|||||||
errorPopup.open()
|
errorPopup.open()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gameIsAlreadySavedAsMultiplayer(gameId)) {
|
||||||
|
ResponsePopup("Game is already added".tr(), this)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
thread(name="MultiplayerDownload") {
|
thread(name="MultiplayerDownload") {
|
||||||
addGameButton.setText("Working...".tr())
|
addGameButton.setText("Working...".tr())
|
||||||
addGameButton.disable()
|
addGameButton.disable()
|
||||||
|
Loading…
Reference in New Issue
Block a user