Skip to content

Commit

Permalink
Fix T91217: Avoid traceback in case of invalid gltf file
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduroure committed Sep 8, 2021
1 parent f01eb6c commit aba77f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit aba77f1

Please sign in to comment.