[Bf-extensions-cvs] [3a409083] master: Add Curve Extra Objects: Fix invalid context traceback error

Ethan Simon noreply at git.blender.org
Wed Jun 9 00:01:19 CEST 2021


Commit: 3a409083e7dbc8e5fef5a68f6ac5be275acc5ca8
Author: Ethan Simon
Date:   Tue Jun 8 18:00:37 2021 -0400
Branches: master
https://developer.blender.org/rBA3a409083e7dbc8e5fef5a68f6ac5be275acc5ca8

Add Curve Extra Objects: Fix  invalid context traceback error

This patch simply adds a preliminary check for the built-in Add Curve Extra Objects add-on.
The check basically prevents a traceback in the console.
Without this patch the add-on still functions as intended, just with a console prompt.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D9666

===================================================================

M	add_curve_extra_objects/beveltaper_curve.py

===================================================================

diff --git a/add_curve_extra_objects/beveltaper_curve.py b/add_curve_extra_objects/beveltaper_curve.py
index 27795ed1..5b71cf00 100644
--- a/add_curve_extra_objects/beveltaper_curve.py
+++ b/add_curve_extra_objects/beveltaper_curve.py
@@ -424,10 +424,11 @@ def menu_funcs(self, context):
 
     layout = self.layout
 
-    if bpy.context.view_layer.objects.active.type == "CURVE":
-        layout.operator("curve.bevelcurve")
-        layout.operator("curve.tapercurve")
-        layout.separator()
+    if context.view_layer.objects.active:
+        if context.view_layer.objects.active.type == "CURVE":
+            layout.operator("curve.bevelcurve")
+            layout.operator("curve.tapercurve")
+            layout.separator()
 
 # Register
 classes = [



More information about the Bf-extensions-cvs mailing list