From fb661e5a13e09d64629d5b3a8d88b1ba5df628f7 Mon Sep 17 00:00:00 2001
From: Bastien Montagne <montagne29@wanadoo.fr>
Date: Wed, 2 Dec 2015 17:03:56 +0100
Subject: [PATCH] Fix related to T46912: Check a bit better we get a valid
 object generated from crappy FBX data.

Also print version of FBX file in console messages.
---
 io_scene_fbx/__init__.py   | 2 +-
 io_scene_fbx/import_fbx.py | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 6e23b4997..f1a19c0b6 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (3, 6, 4),
+    "version": (3, 6, 5),
     "blender": (2, 76, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index d3dbf9832..9b37f7d22 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -2092,7 +2092,7 @@ class FbxImportHelperNode:
                 child_obj = child.build_skeleton_children(fbx_tmpl, settings, scene)
 
             return arm
-        elif self.fbx_elem:
+        elif self.fbx_elem and not self.is_bone:
             obj = self.build_node_obj(fbx_tmpl, settings)
 
             # walk through children
@@ -2163,7 +2163,8 @@ class FbxImportHelperNode:
             # walk through children
             for child in self.children:
                 child_obj = child.link_hierarchy(fbx_tmpl, settings, scene)
-                child_obj.parent = obj
+                if child_obj:
+                    child_obj.parent = obj
 
             return obj
         else:
@@ -2242,6 +2243,8 @@ def load(operator, context, filepath="",
         operator.report({'ERROR'}, "Version %r unsupported, must be %r or later" % (version, 7100))
         return {'CANCELLED'}
 
+    print("FBX version: %r" % version)
+
     if bpy.ops.object.mode_set.poll():
         bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
-- 
GitLab