[Bf-blender-cvs] [074cbc403cb] blender2.8: Fix material properties Python error when there is no active object.

Brecht Van Lommel noreply at git.blender.org
Wed Oct 10 15:09:25 CEST 2018


Commit: 074cbc403cb5498fddb1f963317fcd67b227c7c6
Author: Brecht Van Lommel
Date:   Wed Oct 10 14:00:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB074cbc403cb5498fddb1f963317fcd67b227c7c6

Fix material properties Python error when there is no active object.

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

M	release/scripts/startup/bl_ui/properties_material_gpencil.py

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

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index cdd39497db5..5fb9d9795e3 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -157,11 +157,14 @@ class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         ob = context.object
+        if ob is None:
+            return False
+
         ma = context.object.active_material
         if ma is None or ma.grease_pencil is None:
             return False
 
-        return ob and ob.type == 'GPENCIL'
+        return ob.type == 'GPENCIL'
 
     def draw_header_preset(self, context):
         MATERIAL_PT_gpencil_material_presets.draw_panel_header(self.layout)



More information about the Bf-blender-cvs mailing list