# PretransformVertices: fix crash during scene destruction if the resulting scene is empty
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@960 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
5576b31aa6
commit
2ecbf3f244
|
@ -537,6 +537,12 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no meshes are referenced in the node graph it is possible that we get no output meshes.
|
||||||
|
if (apcOutMeshes.empty()) {
|
||||||
|
throw DeadlyImportError("No output meshes: all meshes are orphaned and are not referenced by any nodes");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// now delete all meshes in the scene and build a new mesh list
|
// now delete all meshes in the scene and build a new mesh list
|
||||||
for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
|
for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
|
||||||
{
|
{
|
||||||
|
@ -560,19 +566,14 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
mesh = NULL;
|
mesh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no meshes are referenced in the node graph it is possible that we get no output meshes.
|
|
||||||
if (apcOutMeshes.empty()) {
|
|
||||||
throw DeadlyImportError("No output meshes: all meshes are orphaned and are not referenced by nodes");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// It is impossible that we have more output meshes than
|
// It is impossible that we have more output meshes than
|
||||||
// input meshes, so we can easily reuse the old mesh array
|
// input meshes, so we can easily reuse the old mesh array
|
||||||
pScene->mNumMeshes = (unsigned int)apcOutMeshes.size();
|
pScene->mNumMeshes = (unsigned int)apcOutMeshes.size();
|
||||||
for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
|
for (unsigned int i = 0; i < pScene->mNumMeshes;++i) {
|
||||||
pScene->mMeshes[i] = apcOutMeshes[i];
|
pScene->mMeshes[i] = apcOutMeshes[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove all animations from the scene
|
// remove all animations from the scene
|
||||||
for (unsigned int i = 0; i < pScene->mNumAnimations;++i)
|
for (unsigned int i = 0; i < pScene->mNumAnimations;++i)
|
||||||
|
|
Loading…
Reference in New Issue