Skip to content

Commit

Permalink
Multiplayer screen correctly handles errors when downloading mods
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Jan 21, 2025
1 parent 159f2e5 commit 2f79658
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@ class MultiplayerScreen : PickerScreen() {

// Download missing mods
Concurrency.runOnNonDaemonThreadPool(LoadGameScreen.downloadMissingMods) {
LoadGameScreen.loadMissingMods(missingMods, onModDownloaded = {
Concurrency.runOnGLThread { ToastPopup("[$it] Downloaded!", this@MultiplayerScreen) }
},
onCompleted = {
RulesetCache.loadRulesets()
Concurrency.runOnGLThread { MultiplayerHelpers.loadMultiplayerGame(this@MultiplayerScreen, selectedGame!!) }
})
try {
LoadGameScreen.loadMissingMods(missingMods, onModDownloaded = {
Concurrency.runOnGLThread { ToastPopup("[$it] Downloaded!", this@MultiplayerScreen) }
},
onCompleted = {
RulesetCache.loadRulesets()
Concurrency.runOnGLThread { MultiplayerHelpers.loadMultiplayerGame(this@MultiplayerScreen, selectedGame!!) }
})
} catch (ex: Exception) {
val (message) = LoadGameScreen.getLoadExceptionMessage(ex)
launchOnGLThread { ToastPopup(message, this@MultiplayerScreen) }
}
}
}
}
Expand Down

0 comments on commit 2f79658

Please sign in to comment.