Merge pull request #2490 from olsoneric/add_null_check_py

Ensure obj is not null before using hasattr
pull/2484/head^2
Kim Kulling 2019-06-03 00:11:11 +02:00 committed by GitHub
commit 04117e1378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -82,7 +82,8 @@ def call_init(obj, caller = None):
_init(obj,parent=caller) _init(obj,parent=caller)
def _is_init_type(obj): 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]) return _is_init_type(obj[0])
# null-pointer case that arises when we reach a mesh attribute # null-pointer case that arises when we reach a mesh attribute
# like mBitangents which use mNumVertices rather than mNumBitangents # like mBitangents which use mNumVertices rather than mNumBitangents