From 5bbcc3d783b7be373eb61277c392960519c84375 Mon Sep 17 00:00:00 2001 From: AlaaCG Date: Sun, 15 Sep 2024 07:39:51 +0200 Subject: [PATCH] added obj check this error prints a few times when right clicking or randomly when doing something the viewport When there are no objects in the scene with the addon enabled, it kept annoying me so here is a pull request it ends with this: path_to\Blender\4.2\extensions\blender_org\boltfactory\Boltfactory.py", line 477, in Bolt_contex_menu if obj.data is not None and 'Bolt' in obj.data.keys(): ^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'data' it's really a simple, can be just fixed by checking if there is an object in the first place before trying to access it's data in this case, adding "obj and" fixes it, hope this gets merged, Thanks --- source/Boltfactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index 5c3c99f..2ff740b 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -474,7 +474,7 @@ def Bolt_contex_menu(self, context): obj = context.object layout = self.layout - if obj.data is not None and 'Bolt' in obj.data.keys(): + if obj and obj.data is not None and 'Bolt' in obj.data.keys(): props = layout.operator("mesh.bolt_add", text="Change Bolt") props.change = True for prm in BoltParameters(): -- 2.30.2