From 0cbabdf69ea8527e9a1ca8a16175ecff382ac286 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 25 Oct 2024 18:00:25 +0500 Subject: [PATCH] Fix console errors from UI when no object is selected Example error: Traceback (most recent call last): File "\Blender\4.2\scripts\modules\bpy_types.py", line 1034, in draw_ls func(self, context) File "\Blender\4.2\extensions\blender_org\curve_tools\__init__.py", line 481, in curve_tools_object_context_menu if context.active_object.type == "CURVE": ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'type' --- source/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/__init__.py b/source/__init__.py index 516f4e0..6ea3b22 100644 --- a/source/__init__.py +++ b/source/__init__.py @@ -466,7 +466,7 @@ def curve_tools_context_menu(self, context): def curve_tools_object_context_menu(self, context): bl_label = 'Curve tools' - if context.active_object.type == "CURVE": + if (obj := context.active_object) and obj.type == "CURVE": self.layout.operator("curvetools.scale_reset", text="Scale Reset") self.layout.operator("curvetools.add_toolpath_offset_curve", text="Offset Curve") self.layout.operator("curvetools.remove_doubles", text='Remove Doubles') -- 2.30.2