mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-24 10:01:39 +07:00
Fix: Potential crash on new game after deleting a base ruleset mod (#11508)
* Fix: Potential crash on new game after deleting a base ruleset mod * Review
This commit is contained in:
parent
5c6d9171c4
commit
f6e432691d
@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
||||
import com.unciv.models.metadata.BaseRuleset
|
||||
import com.unciv.models.metadata.GameParameters
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.ruleset.RulesetCache
|
||||
@ -79,12 +80,15 @@ class ModCheckboxTable(
|
||||
deselectIncompatibleMods(null)
|
||||
}
|
||||
|
||||
fun setBaseRuleset(newBaseRuleset: String) {
|
||||
baseRulesetName = newBaseRuleset
|
||||
fun setBaseRuleset(newBaseRulesetName: String) {
|
||||
val newBaseRuleset = RulesetCache[newBaseRulesetName]
|
||||
// We're calling this from init, baseRuleset is lateinit, and the mod may have been deleted: Must make sure baseRuleset is initialized
|
||||
?: return setBaseRuleset(BaseRuleset.Civ_V_GnK.fullName)
|
||||
baseRulesetName = newBaseRulesetName
|
||||
baseRuleset = newBaseRuleset
|
||||
savedModcheckResult = null
|
||||
clear()
|
||||
mods.clear() // We'll regenerate this from checked widgets
|
||||
baseRuleset = RulesetCache[newBaseRuleset] ?: return
|
||||
|
||||
val compatibleMods = modWidgets
|
||||
.filter { ModCompatibility.meetsBaseRequirements(it.mod, baseRuleset) }
|
||||
|
Loading…
Reference in New Issue
Block a user