1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

Watch for empty children node refs when setting parents

This commit is contained in:
Chris Robinson 2012-07-03 18:37:04 -07:00
parent 832247bff2
commit d8d00123ea
3 changed files with 8 additions and 4 deletions

View file

@ -203,7 +203,7 @@ void NiSkinInstance::post(NIFFile *nif)
root->makeRootBone(data->trafo);
for(int i=0; i<bnum; i++)
for(size_t i=0; i<bnum; i++)
{
if(!bones.has(i))
nif->fail("Oops: Missing bone! Don't know how to handle this.");

View file

@ -149,7 +149,11 @@ struct NiNode : Node
effects.post(nif);
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;
}
}
};

View file

@ -53,6 +53,7 @@ public:
// Store the index for later
index = nif->getInt();
assert(index >= -1);
}
/// Resolve index to pointer
@ -117,11 +118,10 @@ public:
bool has(size_t index)
{
assert(index >= 0 && index < static_cast<int> (list.size()));
return !list.at(index).empty();
}
int length()
size_t length()
{ return list.size(); }
};