Watch for empty children node refs when setting parents

actorid
Chris Robinson 13 years ago
parent 832247bff2
commit d8d00123ea

@ -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.");

@ -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;
}
}
};

@ -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(); }
};

Loading…
Cancel
Save