Skip to content

Commit

Permalink
Fix ANR caused by URL checking for Github URL with query
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Dec 17, 2024
1 parent 9921004 commit 5e6a3e0
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions core/src/com/unciv/ui/screens/modmanager/ModManagementScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,19 @@ class ModManagementScreen private constructor(
actualDownloadButton.onClick {
actualDownloadButton.setText("Downloading...".tr())
actualDownloadButton.disable()
val repo = GithubAPI.Repo.parseUrl(textField.text)
if (repo == null) {
ToastPopup("«RED»{Invalid link!}«»", this@ModManagementScreen)
actualDownloadButton.setText("Download".tr())
actualDownloadButton.enable()
} else
downloadMod(repo, {
actualDownloadButton.setText("{Downloading...} ${it}%".tr())
}) { popup.close() }
Concurrency.run {
val repo = GithubAPI.Repo.parseUrl(textField.text)
if (repo == null) {
Concurrency.runOnGLThread {
ToastPopup("«RED»{Invalid link!}«»", this@ModManagementScreen)
actualDownloadButton.setText("Download".tr())
actualDownloadButton.enable()
}
} else
downloadMod(repo, {
actualDownloadButton.setText("{Downloading...} ${it}%".tr())
}) { popup.close() }
}
}
popup.add(actualDownloadButton).row()
popup.addCloseButton()
Expand Down

0 comments on commit 5e6a3e0

Please sign in to comment.