diff --git a/test/unit/ModelDiffer.cpp b/test/unit/ModelDiffer.cpp index f443b322d..8858ce8c5 100644 --- a/test/unit/ModelDiffer.cpp +++ b/test/unit/ModelDiffer.cpp @@ -94,6 +94,14 @@ bool ModelDiffer::isEqual( const aiScene *expected, const aiScene *toCompare ) { addDiff( stream.str() ); return false; } + + if ( expected->mNumMaterials > 0 ) { + if ( nullptr == expected->mMaterials || nullptr == toCompare->mMaterials ) { + addDiff( "Number of materials > 0 and mat pointer is nullptr" ); + return false; + } + } + for ( unsigned int i = 0; i < expected->mNumMaterials; i++ ) { aiMaterial *expectedMat( expected->mMaterials[ i ] ); aiMaterial *toCompareMat( expected->mMaterials[ i ] ); diff --git a/test/unit/utObjImportExport.cpp b/test/unit/utObjImportExport.cpp index 6e54dcdba..63d2c4ee5 100644 --- a/test/unit/utObjImportExport.cpp +++ b/test/unit/utObjImportExport.cpp @@ -124,6 +124,7 @@ protected: expScene->mMeshes[ 0 ] = mesh; expScene->mNumMaterials = 1; + expScene->mMaterials = new aiMaterial*[ expScene->mNumMaterials ]; return expScene; }