From cdc9360ec38316abd942ceeefffb34f11d368483 Mon Sep 17 00:00:00 2001 From: Sebastian Sille <nrgsille@noreply.localhost> Date: Wed, 8 Nov 2023 12:49:20 +0100 Subject: [PATCH] Import_3ds: Fix crash if mesh has no faces Avoid crash with broken 3ds faces chunk --- io_scene_3ds/import_3ds.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index 4c7080bc5..0c3a29537 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -427,8 +427,11 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI # in rare cases no materials defined. bmesh.materials.append(bmat) # can be None - for fidx in faces: - bmesh.polygons[fidx].material_index = mat_idx + if bmesh.polygons: + for fidx in faces: + bmesh.polygons[fidx].material_index = mat_idx + else: + print("\tError: Mesh has no faces!") if uv_faces: uvl = bmesh.uv_layers.active.data[:] @@ -1626,6 +1629,7 @@ def load_3ds(filepath, context, CONSTRAIN=10.0, UNITS=False, IMAGE_SEARCH=True, # here we go! read_chunk(file, current_chunk) if current_chunk.ID != PRIMARY: + context.window.cursor_set('DEFAULT') print("\tFatal Error: Not a valid 3ds file: %r" % filepath) file.close() return -- GitLab