From c5a84e2e1ad002f55ace47eeefe4f7deedeb75b5 Mon Sep 17 00:00:00 2001
From: Julien Duroure <julien.duroure@gmail.com>
Date: Sun, 6 Dec 2020 07:49:04 +0100
Subject: [PATCH] gltf exporter: Fix T83188: avoid crash when background
 exporting (without UI)

---
 io_scene_gltf2/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index eec978a3b..50dab7180 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,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": (1, 5, 6),
+    "version": (1, 5, 7),
     'blender': (2, 91, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
@@ -73,6 +73,8 @@ extension_panel_unregister_functors = []
 def on_export_format_changed(self, context):
     # Update the file extension when the format (.glb/.gltf) changes
     sfile = context.space_data
+    if sfile is None:
+        return # Avoid error when export from background
     operator = sfile.active_operator
     if operator.bl_idname != "EXPORT_SCENE_OT_gltf":
         return
-- 
GitLab