Fix crash when an item grants a skill below its lowest defined level - #2543
Open
juddisjudd wants to merge 1 commit into
Open
juddisjudd wants to merge 1 commit into
juddisjudd wants to merge 1 commit into
Conversation
getGrantedSkillLevel falls back to level 1 when no level at or below the item's level qualifies. The 0.5.5 export defines some granted skills only at higher levels: Pinnacle of Power, granted by Adonia's Ego, has only level 20. levels[1] is then nil and CalcSetup errors while setting the gem's requirements, so any build with the wand fails to calculate. Fall back to the lowest level the skill defines instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the problem being solved:
getGrantedSkillLevelreturns level 1 when no level at or below the item's level qualifies. Since the 0.5.5 export (#2505), some granted skills define only higher levels. Pinnacle of Power, granted by Adonia's Ego, has only level 20. This has two effects:CalcSetup.luaatgrantedEffect.levels[level].levelRequirement(attempt to index a nil value). The whole build then fails to calculate.This change falls back to the lowest level the skill defines, so Pinnacle of Power gets level 20.
Steps taken to verify a working solution:
CalcSetup.lua:2167.Link to a build that showcases this PR:
No public link. Any build saved before #2505 with Adonia's Ego equipped reproduces it.
Before screenshot:
CalcSetup.lua:2167: attempt to index a nil value; the build shows no stats.After screenshot:
The build calculates, with Pinnacle of Power at level 20.