diff --git a/components/nif/data.cpp b/components/nif/data.cpp index fd94c5753a..54fdea6f8c 100644 --- a/components/nif/data.cpp +++ b/components/nif/data.cpp @@ -338,9 +338,9 @@ namespace Nif && nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 0)) partitions.read(nif); - // Has vertex weights flag - if (nif->getVersion() > NIFStream::generateVersion(4, 2, 1, 0) && !nif->getBoolean()) - return; + bool hasVertexWeights = true; + if (nif->getVersion() > NIFStream::generateVersion(4, 2, 1, 0)) + hasVertexWeights = nif->getBoolean(); bones.resize(boneNum); for (BoneInfo& bi : bones) @@ -351,8 +351,12 @@ namespace Nif bi.boundSphereCenter = nif->getVector3(); bi.boundSphereRadius = nif->getFloat(); - // Number of vertex weights - bi.weights.resize(nif->getUShort()); + size_t numVertices = nif->getUShort(); + + if (!hasVertexWeights) + continue; + + bi.weights.resize(numVertices); for (size_t j = 0; j < bi.weights.size(); j++) { bi.weights[j].vertex = nif->getUShort();