diff --git a/d2core/d2hero/hero_skill_util.go b/d2core/d2hero/hero_skill_util.go index 478b39a9..81c28262 100644 --- a/d2core/d2hero/hero_skill_util.go +++ b/d2core/d2hero/hero_skill_util.go @@ -8,6 +8,12 @@ import "github.com/OpenDiablo2/OpenDiablo2/d2core/d2asset" func HydrateSkills(skills map[int]*HeroSkill, asset *d2asset.AssetManager) { for skillID := range skills { heroSkill := skills[skillID] + + // TODO: figure out why these are nil sometimes + if heroSkill == nil { + continue + } + heroSkill.SkillRecord = asset.Records.Skill.Details[skillID] heroSkill.SkillDescriptionRecord = asset.Records.Skill.Descriptions[heroSkill.SkillRecord.Skilldesc] heroSkill.SkillPoints = skills[skillID].SkillPoints diff --git a/d2core/d2hero/hero_state_factory.go b/d2core/d2hero/hero_state_factory.go index b6e3352e..84a32839 100644 --- a/d2core/d2hero/hero_state_factory.go +++ b/d2core/d2hero/hero_state_factory.go @@ -187,6 +187,12 @@ func (f *HeroStateFactory) LoadHeroState(filePath string) *HeroState { // We cant do this while unmarshalling because there is no reference to the asset manager. for idx := range result.Skills { hs := result.Skills[idx] + + // TODO: figure out why this can be nil + if hs == nil { + continue + } + hs.SkillRecord = f.asset.Records.Skill.Details[hs.shallow.SkillID] hs.SkillDescriptionRecord = f.asset.Records.Skill.Descriptions[hs.SkillRecord.Skilldesc] hs.SkillPoints = hs.shallow.SkillPoints