Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where fishing with PlayerProjectile.enableScaleWithSkillLevel causes inability to save #777

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

Grantapher
Copy link

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 is None for the fishing rod. Casting the rod triggers ProjectileAttackTriggered, which then calls player.m_skills.GetSkill(skillType) with a skillType of None. When GetSkill doesn't find an existing skill for None, it creates a new one for None with 0 xp and level as well as null m_info. This is added to the list of skills to later be saved. When Skill.Save is called there is a line of code which tries to read skill.m_info.m_skill, which causes the NullReferenceException, since skill.m_info is null.

The fix ensures we skip calling GetSkill when skillType is None.

I also added this check to the other place where GetSkill is called, just in case.

@Grantapher Grantapher mentioned this pull request Feb 6, 2023
Copy link
Contributor

@healiha healiha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Also, thanks for fixing this unsightly try/catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]
3 participants