Skip to content

Commit fecc682

Browse files
committed
- Fix for hair not being convertable via item converter.
1 parent 4f5a94b commit fecc682

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

xivModdingFramework/Mods/RootCloner.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,18 +355,21 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
355355
}
356356

357357
// Poke through the variants and adjust any that point to null Material Sets to instead use a valid one.
358-
var valid = newMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
359-
if(valid <= 0)
358+
if (newMetadata.ImcEntries.Count > 0 && originalMetadata.ImcEntries.Count > 0)
360359
{
361-
valid = originalMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
362-
}
360+
var valid = newMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
361+
if (valid <= 0)
362+
{
363+
valid = originalMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
364+
}
363365

364-
for(int i = 0; i < newMetadata.ImcEntries.Count; i++)
365-
{
366-
var entry = newMetadata.ImcEntries[i];
367-
if (entry.MaterialSet == 0)
366+
for (int i = 0; i < newMetadata.ImcEntries.Count; i++)
368367
{
369-
entry.MaterialSet = valid;
368+
var entry = newMetadata.ImcEntries[i];
369+
if (entry.MaterialSet == 0)
370+
{
371+
entry.MaterialSet = valid;
372+
}
370373
}
371374
}
372375

0 commit comments

Comments
 (0)