mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-01 15:49:46 +07:00
Exception handleing when loading mod options (#7279)
* try catches * catching specific exceptions * try catch when calling the function * removed unused import
This commit is contained in:
@ -10,6 +10,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.badlogic.gdx.utils.SerializationException
|
||||
import com.unciv.MainMenuScreen
|
||||
import com.unciv.json.fromJsonFile
|
||||
import com.unciv.json.json
|
||||
@ -41,6 +42,7 @@ import com.unciv.ui.utils.extensions.onClick
|
||||
import com.unciv.ui.utils.extensions.toCheckBox
|
||||
import com.unciv.ui.utils.extensions.toLabel
|
||||
import com.unciv.ui.utils.extensions.toTextButton
|
||||
import com.unciv.utils.Log
|
||||
import com.unciv.utils.concurrency.Concurrency
|
||||
import com.unciv.utils.concurrency.launchOnGLThread
|
||||
import kotlinx.coroutines.Job
|
||||
@ -258,7 +260,15 @@ class ModManagementScreen(
|
||||
}
|
||||
|
||||
if (installedMod.modOptions.author.isEmpty()) {
|
||||
Github.rewriteModOptions(repo, installedMod.folderLocation!!)
|
||||
try {
|
||||
Github.rewriteModOptions(repo, installedMod.folderLocation!!)
|
||||
} catch (ex: SerializationException) {
|
||||
Log.error("Error while adding mod info from repo search:", ex)
|
||||
return
|
||||
} catch (ex: Exception) {
|
||||
Log.error("Error while adding mod info from repo search:", ex)
|
||||
return
|
||||
}
|
||||
installedMod.modOptions.author = repo.owner.login
|
||||
installedMod.modOptions.modSize = repo.size
|
||||
}
|
||||
|
Reference in New Issue
Block a user