Skip to content

Commit

Permalink
Handle missing armors in wig/hair check.
Browse files Browse the repository at this point in the history
If it can't find a Worn Armor, it will warn in the log and subsequently ignore the reference.

Fixes #67.
  • Loading branch information
focustense committed Jul 23, 2021
1 parent 34c4981 commit f705552
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Focus.Apps.EasyNpc/Mutagen/MutagenAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,15 @@ private IEnumerable<VanillaRace> GetValidRaces(IHeadPartGetter headPart)
.Select(x => x.FormKey.AsLink<IHeadPartGetter>().Resolve(Environment.LinkCache))
.Where(x => x.Type == HeadPart.TypeEnum.Hair)
.All(x => string.IsNullOrEmpty(x.Model?.File));
var wornArmor = npc.WornArmor.Resolve(Environment.LinkCache);
var wornArmor = npc.WornArmor.TryResolve(Environment.LinkCache);
if (wornArmor == null)
{
log.Warning(
"NPC {formKey} {editorId} references missing armor {referencedFormKey} as its Worn Armor. " +
"Wig and body customizations for this NPC will be ignored.",
npc.FormKey, npc.EditorID, npc.WornArmor.FormKey);
return null;
}
return wornArmor.Armature
.Select(fk => fk.Resolve(Environment.LinkCache))
.Where(x =>
Expand Down

0 comments on commit f705552

Please sign in to comment.