From 3a409083e7dbc8e5fef5a68f6ac5be275acc5ca8 Mon Sep 17 00:00:00 2001
From: Ethan Simon <razed>
Date: Tue, 8 Jun 2021 18:00:37 -0400
Subject: [PATCH] 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
---
 add_curve_extra_objects/beveltaper_curve.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/add_curve_extra_objects/beveltaper_curve.py b/add_curve_extra_objects/beveltaper_curve.py
index 27795ed15..5b71cf00e 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 = [
-- 
GitLab