[Bf-extensions-cvs] [672cfe9c] master: Fixed errors in the console if obj.data is None Errors appeared when calling the context menu on an object without data

Vladimir Spivakcwolf3d noreply at git.blender.org
Wed Dec 2 23:10:06 CET 2020


Commit: 672cfe9c85e2ac71b97b5331d9034d23c9723d71
Author: Vladimir Spivak(cwolf3d)
Date:   Thu Dec 3 00:04:56 2020 +0200
Branches: master
https://developer.blender.org/rBA672cfe9c85e2ac71b97b5331d9034d23c9723d71

Fixed errors in the console if obj.data is None
Errors appeared when calling the context menu on an object without data

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

M	add_mesh_BoltFactory/Boltfactory.py
M	add_mesh_extra_objects/__init__.py
M	add_mesh_geodesic_domes/__init__.py

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

diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py
index 330df8ae..f2646704 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -481,7 +481,7 @@ def Bolt_contex_menu(self, context):
     obj = context.object
     layout = self.layout
 
-    if 'Bolt' in obj.data.keys():
+    if 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():
diff --git a/add_mesh_extra_objects/__init__.py b/add_mesh_extra_objects/__init__.py
index fa7918ef..8a697ae5 100644
--- a/add_mesh_extra_objects/__init__.py
+++ b/add_mesh_extra_objects/__init__.py
@@ -249,7 +249,7 @@ def Extras_contex_menu(self, context):
     obj = context.object
     layout = self.layout
 
-    if obj == None:
+    if obj == None or obj.data is None:
         return
 
     if 'Gear' in obj.data.keys():
diff --git a/add_mesh_geodesic_domes/__init__.py b/add_mesh_geodesic_domes/__init__.py
index 00ee10aa..e88f3184 100644
--- a/add_mesh_geodesic_domes/__init__.py
+++ b/add_mesh_geodesic_domes/__init__.py
@@ -54,7 +54,7 @@ def Geodesic_contex_menu(self, context):
     obj = context.object
     layout = self.layout
 
-    if 'GeodesicDome' in obj.data.keys():
+    if obj.data is not None and 'GeodesicDome' in obj.data.keys():
         props = layout.operator("mesh.generate_geodesic_dome", text="Change Geodesic Dome")
         props.change = True
         for prm in third_domes_panel_271.GeodesicDomeParameters():



More information about the Bf-extensions-cvs mailing list