Fix T77082: Greasepencil error accessing material dropdown on an object without materials

Differential Revision: https://developer.blender.org/D7841
This commit is contained in:
Philipp Oeser 2020-05-26 10:57:06 +02:00
parent 2299f6b5a7
commit d3275178fe
Notes: blender-bot 2023-05-31 04:43:10 +02:00
Referenced by issue #77082, GPencil: Error accessing material dropdown on an object without materials
1 changed files with 1 additions and 1 deletions

View File

@ -639,7 +639,7 @@ class GreasePencilMaterialsPanel:
if is_view3d and brush is not None:
gp_settings = brush.gpencil_settings
if gp_settings.use_material_pin is False:
if ob.active_material_index >= 0:
if len(ob.material_slots) > 0 and ob.active_material_index >= 0:
ma = ob.material_slots[ob.active_material_index].material
else:
ma = gp_settings.material