Throw a DeadlyImportError rather than an assertion if all materials are redundant and thus removed
Closes: https://github.com/assimp/assimp/issues/4224 Closes: https://github.com/assimp/assimp/issues/4225pull/4226/head
parent
6e090c88b8
commit
9a7ee0ac14
|
@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/ParsingUtils.h>
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "Material/MaterialSystem.h"
|
#include "Material/MaterialSystem.h"
|
||||||
|
#include <assimp/Exceptional.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -171,6 +172,8 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
|
||||||
}
|
}
|
||||||
// If the new material count differs from the original,
|
// If the new material count differs from the original,
|
||||||
// we need to rebuild the material list and remap mesh material indexes.
|
// we need to rebuild the material list and remap mesh material indexes.
|
||||||
|
if(iNewNum < 1)
|
||||||
|
throw DeadlyImportError("No materials remaining");
|
||||||
if (iNewNum != pScene->mNumMaterials) {
|
if (iNewNum != pScene->mNumMaterials) {
|
||||||
ai_assert(iNewNum > 0);
|
ai_assert(iNewNum > 0);
|
||||||
aiMaterial** ppcMaterials = new aiMaterial*[iNewNum];
|
aiMaterial** ppcMaterials = new aiMaterial*[iNewNum];
|
||||||
|
|
Loading…
Reference in New Issue