Jelajahi Sumber

Merge pull request #2490 from olsoneric/add_null_check_py

Ensure obj is not null before using hasattr
Kim Kulling 6 tahun lalu
induk
melakukan
04117e1378
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      port/PyAssimp/pyassimp/core.py

+ 2 - 1
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