Fix loading .ASE models with no materials

The "A Place of Malice" custom map has such a model which caused a crash
(models/z13sp2/temple/pushable_collision_box.ASE), see #382
This commit is contained in:
Daniel Gibson 2021-05-19 02:48:31 +02:00
parent 227fe5fc92
commit 0b28322500

View file

@ -814,8 +814,8 @@ bool idRenderModelStatic::ConvertASEToModelSurfaces( const struct aseModel_s *as
for ( objectNum = 0 ; objectNum < ase->objects.Num() ; objectNum++ ) {
object = ase->objects[objectNum];
mesh = &object->mesh;
material = ase->materials[object->materialRef];
im1 = declManager->FindMaterial( material->name );
material = (ase->materials.Num() > object->materialRef) ? ase->materials[object->materialRef] : NULL;
im1 = declManager->FindMaterial( material ? material->name : NULL );
bool normalsParsed = mesh->normalsParsed;