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
|
||||
fun addMultiplayerGame(gameId: String, gameName: String = ""){
|
||||
if (gameIsAlreadySavedAsMultiplayer(gameId)) {
|
||||
ResponsePopup("Game is already added".tr(), this)
|
||||
return
|
||||
}
|
||||
//gameId must be nullable because clipboard content could be null
|
||||
fun addMultiplayerGame(gameId: String?, gameName: String = ""){
|
||||
try {
|
||||
//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) {
|
||||
val errorPopup = Popup(this)
|
||||
errorPopup.addGoodSizedLabel("Invalid game ID!".tr())
|
||||
@ -127,6 +124,12 @@ class MultiplayerScreen() : PickerScreen() {
|
||||
errorPopup.open()
|
||||
return
|
||||
}
|
||||
|
||||
if (gameIsAlreadySavedAsMultiplayer(gameId)) {
|
||||
ResponsePopup("Game is already added".tr(), this)
|
||||
return
|
||||
}
|
||||
|
||||
thread(name="MultiplayerDownload") {
|
||||
addGameButton.setText("Working...".tr())
|
||||
addGameButton.disable()
|
||||
|
Loading…
Reference in New Issue
Block a user