JoinVerticesProcess: iAdd test for possible null pointer access.
parent
51c9a9f80c
commit
dfbae1294f
|
@ -357,23 +357,24 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust bone vertex weights.
|
// adjust bone vertex weights.
|
||||||
for( int a = 0; a < (int)pMesh->mNumBones; a++)
|
for( int a = 0; a < (int)pMesh->mNumBones; a++) {
|
||||||
{
|
|
||||||
aiBone* bone = pMesh->mBones[a];
|
aiBone* bone = pMesh->mBones[a];
|
||||||
std::vector<aiVertexWeight> newWeights;
|
std::vector<aiVertexWeight> newWeights;
|
||||||
newWeights.reserve( bone->mNumWeights);
|
newWeights.reserve( bone->mNumWeights);
|
||||||
|
|
||||||
for( unsigned int b = 0; b < bone->mNumWeights; b++)
|
if ( NULL != bone->mWeights ) {
|
||||||
{
|
for ( unsigned int b = 0; b < bone->mNumWeights; b++ ) {
|
||||||
const aiVertexWeight& ow = bone->mWeights[b];
|
const aiVertexWeight& ow = bone->mWeights[ b ];
|
||||||
// if the vertex is a unique one, translate it
|
// if the vertex is a unique one, translate it
|
||||||
if( !(replaceIndex[ow.mVertexId] & 0x80000000))
|
if ( !( replaceIndex[ ow.mVertexId ] & 0x80000000 ) ) {
|
||||||
{
|
aiVertexWeight nw;
|
||||||
aiVertexWeight nw;
|
nw.mVertexId = replaceIndex[ ow.mVertexId ];
|
||||||
nw.mVertexId = replaceIndex[ow.mVertexId];
|
nw.mWeight = ow.mWeight;
|
||||||
nw.mWeight = ow.mWeight;
|
newWeights.push_back( nw );
|
||||||
newWeights.push_back( nw);
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
DefaultLogger::get()->error( "X-Export: aiBone shall contain weights, but pointer to them is NULL." );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newWeights.size() > 0) {
|
if (newWeights.size() > 0) {
|
||||||
|
|
Loading…
Reference in New Issue