diff --git a/components/nif/nif_file.cpp b/components/nif/nif_file.cpp index 48dd76510..42aa43f8b 100644 --- a/components/nif/nif_file.cpp +++ b/components/nif/nif_file.cpp @@ -203,7 +203,7 @@ void NiSkinInstance::post(NIFFile *nif) root->makeRootBone(data->trafo); - for(int i=0; ifail("Oops: Missing bone! Don't know how to handle this."); diff --git a/components/nif/node.hpp b/components/nif/node.hpp index e4cc9291e..5a2847b6c 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -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; + } } }; diff --git a/components/nif/record_ptr.hpp b/components/nif/record_ptr.hpp index ac91e25e3..755094147 100644 --- a/components/nif/record_ptr.hpp +++ b/components/nif/record_ptr.hpp @@ -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 (list.size())); return !list.at(index).empty(); } - int length() + size_t length() { return list.size(); } };