From 3924a5c32a135a2f7b2827fe0f7183693b2d6d13 Mon Sep 17 00:00:00 2001 From: Eric Olson Date: Mon, 27 May 2019 12:59:00 -0500 Subject: [PATCH 1/2] Ensure obj is not null before using hasattr Fixes error shown below: File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 320, in load scene = _init(model.contents) File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 206, in _init raise e File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 187, in _init call_init(e, target) File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 80, in call_init _init(obj.contents, obj, caller) File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 214, in _init if _is_init_type(obj): File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 86, in _is_init_type if helper.hasattr_silent(obj,'contents'): #pointer File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\helper.py", line 277, in hasattr_silent return hasattr(object, name) ValueError: NULL pointer access --- port/PyAssimp/pyassimp/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index 44163a434..c346e2652 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -82,7 +82,8 @@ def call_init(obj, caller = None): _init(obj,parent=caller) def _is_init_type(obj): - if helper.hasattr_silent(obj,'contents'): #pointer + + if obj and helper.hasattr_silent(obj,'contents'): #pointer return _is_init_type(obj[0]) # null-pointer case that arises when we reach a mesh attribute # like mBitangents which use mNumVertices rather than mNumBitangents From 48ed2d2d3c6cc1fa73d3ced821b5189de569bc53 Mon Sep 17 00:00:00 2001 From: Mike Samsonov Date: Thu, 30 May 2019 10:54:44 +0100 Subject: [PATCH 2/2] Double precision fix --- code/FBXParser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/FBXParser.cpp b/code/FBXParser.cpp index fe63866a0..5d5c2c6c1 100644 --- a/code/FBXParser.cpp +++ b/code/FBXParser.cpp @@ -643,9 +643,9 @@ void ParseVectorDataArray(std::vector& out, const Element& el) if (type == 'd') { const double* d = reinterpret_cast(&buff[0]); for (unsigned int i = 0; i < count3; ++i, d += 3) { - out.push_back(aiVector3D(static_cast(d[0]), - static_cast(d[1]), - static_cast(d[2]))); + out.push_back(aiVector3D(static_cast(d[0]), + static_cast(d[1]), + static_cast(d[2]))); } // for debugging /*for ( size_t i = 0; i < out.size(); i++ ) {