diff --git a/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py b/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py index 041bf1ebf..8e0d7cbb1 100644 --- a/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py +++ b/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py @@ -184,6 +184,10 @@ def visit(id): # Depth-first walk @staticmethod def create_mesh_object(gltf, vnode): pynode = gltf.data.nodes[vnode.mesh_node_idx] + if not (0 <= pynode.mesh < len(gltf.data.meshes)): + # Avoid traceback for invalid gltf file: invalid reference to meshes array + # So return an empty blender object) + return bpy.data.objects.new(vnode.name or mesh.name, None) pymesh = gltf.data.meshes[pynode.mesh] # Key to cache the Blender mesh by.