mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Watch for empty children node refs when setting parents
This commit is contained in:
parent
832247bff2
commit
d8d00123ea
3 changed files with 8 additions and 4 deletions
|
@ -203,7 +203,7 @@ void NiSkinInstance::post(NIFFile *nif)
|
||||||
|
|
||||||
root->makeRootBone(data->trafo);
|
root->makeRootBone(data->trafo);
|
||||||
|
|
||||||
for(int i=0; i<bnum; i++)
|
for(size_t i=0; i<bnum; i++)
|
||||||
{
|
{
|
||||||
if(!bones.has(i))
|
if(!bones.has(i))
|
||||||
nif->fail("Oops: Missing bone! Don't know how to handle this.");
|
nif->fail("Oops: Missing bone! Don't know how to handle this.");
|
||||||
|
|
|
@ -149,7 +149,11 @@ struct NiNode : Node
|
||||||
effects.post(nif);
|
effects.post(nif);
|
||||||
|
|
||||||
for(size_t i = 0;i < children.length();i++)
|
for(size_t i = 0;i < children.length();i++)
|
||||||
children[i].parent = this;
|
{
|
||||||
|
// Why would a unique list of children contain empty refs?
|
||||||
|
if(children.has(i))
|
||||||
|
children[i].parent = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
|
|
||||||
// Store the index for later
|
// Store the index for later
|
||||||
index = nif->getInt();
|
index = nif->getInt();
|
||||||
|
assert(index >= -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve index to pointer
|
/// Resolve index to pointer
|
||||||
|
@ -117,11 +118,10 @@ public:
|
||||||
|
|
||||||
bool has(size_t index)
|
bool has(size_t index)
|
||||||
{
|
{
|
||||||
assert(index >= 0 && index < static_cast<int> (list.size()));
|
|
||||||
return !list.at(index).empty();
|
return !list.at(index).empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
int length()
|
size_t length()
|
||||||
{ return list.size(); }
|
{ return list.size(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue