Fix bug where fishing with PlayerProjectile.enableScaleWithSkillLevel causes inability to save #777
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.
This fixes #758. I reproduced save not working before this change and working afterwards.
The issue is that
__instance.m_weapon.m_shared.m_skillType
isNone
for the fishing rod. Casting the rod triggersProjectileAttackTriggered
, which then callsplayer.m_skills.GetSkill(skillType)
with askillType
ofNone
. WhenGetSkill
doesn't find an existing skill forNone
, it creates a new one forNone
with 0 xp and level as well as nullm_info
. This is added to the list of skills to later be saved. WhenSkill.Save
is called there is a line of code which tries to readskill.m_info.m_skill
, which causes theNullReferenceException
, sinceskill.m_info
isnull
.The fix ensures we skip calling
GetSkill
whenskillType
isNone
.I also added this check to the other place where
GetSkill
is called, just in case.