diff options
author | Robert Guetzkow <rjg> | 2020-11-06 13:47:35 +0300 |
---|---|---|
committer | Robert Guetzkow <gitcommit@outlook.de> | 2020-11-06 13:52:09 +0300 |
commit | 69751991311a165e97a48ea67ed60e2c6022ee63 (patch) | |
tree | 43542749114b17c7b2f642ef8b59c82cc18af2e9 /add_mesh_extra_objects/add_mesh_gears.py | |
parent | 40e0792c3cae2cb95eef8d08d23364ca2e091eca (diff) |
Fix T82405: Check if active object's data is None
Check if the active object's data is `None` before attempting
to call functions on it. It is `None` if the object is an
empty.
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D9456
Diffstat (limited to 'add_mesh_extra_objects/add_mesh_gears.py')
-rw-r--r-- | add_mesh_extra_objects/add_mesh_gears.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/add_mesh_extra_objects/add_mesh_gears.py b/add_mesh_extra_objects/add_mesh_gears.py index 9655dea9..1d3bc70e 100644 --- a/add_mesh_extra_objects/add_mesh_gears.py +++ b/add_mesh_extra_objects/add_mesh_gears.py @@ -689,7 +689,8 @@ class AddGear(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Gear' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Gear' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -910,7 +911,8 @@ class AddWormGear(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('WormGear' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('WormGear' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name |