From e08c38b02564f07eb9f0f01258b513eb0e511e05 Mon Sep 17 00:00:00 2001
From: Julien Duroure <julien.duroure@gmail.com>
Date: Tue, 2 Apr 2024 08:52:34 +0200
Subject: [PATCH] glTF Exporter: Regression: Fix crash exporting instanced
 collection when lamp option is enabled

Regression introduced in GN instance exporter c24d76a44e5bf1f0a724becbf7a2e7a003a15901
---
 io_scene_gltf2/__init__.py                               | 2 +-
 io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 7554b05e4..b4f7992f2 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -5,7 +5,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (4, 1, 62),
+    "version": (4, 1, 63),
     'blender': (4, 1, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
index 341f2ba2e..a5af6639c 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
@@ -184,7 +184,7 @@ def __gather_extensions(vnode, export_settings):
     extensions = {}
 
     blender_lamp = None
-    if export_settings["gltf_lights"] and vnode.blender_type == VExportNode.INSTANCE:
+    if export_settings["gltf_lights"] and vnode.blender_type == VExportNode.INSTANCE and vnode.data is not None:
         if vnode.data.type in LIGHTS:
             blender_lamp = vnode.data
     elif export_settings["gltf_lights"] and blender_object is not None and (blender_object.type == "LAMP" or blender_object.type == "LIGHT"):
-- 
GitLab