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.
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.