FBX Importer: Don't allocate a zero-length array

aiNode::mChildren should be left nullptr instead.
Zero-length array allocations are surprising and consume bookkeeping space.
pull/5749/head
RichardTea 2024-09-02 16:32:52 +01:00
parent c35200e38e
commit 335adbcf1a
1 changed files with 6 additions and 6 deletions

View File

@ -357,12 +357,12 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
if (nodes.empty()) {
parent->mNumChildren = 0;
parent->mChildren = nullptr;
}
parent->mChildren = new aiNode *[nodes.size()]();
parent->mNumChildren = static_cast<unsigned int>(nodes.size());
for (unsigned int i = 0; i < nodes.size(); ++i) {
parent->mChildren[i] = nodes[i].mOwnership.release();
} else {
parent->mChildren = new aiNode *[nodes.size()]();
parent->mNumChildren = static_cast<unsigned int>(nodes.size());
for (unsigned int i = 0; i < nodes.size(); ++i) {
parent->mChildren[i] = nodes[i].mOwnership.release();
}
}
}