Fix: Variable referenced in UI code without being assigned

Mistake in d4d046a673
Right now python error is triggered with empty material slot.

Pull Request: https://projects.blender.org/blender/blender/pulls/133287
This commit is contained in:
Pratik Borhade 2025-01-22 10:43:09 +01:00 committed by Pratik Borhade
parent c749f6c376
commit 446b2a983d

View file

@ -46,8 +46,12 @@ class GPENCIL_UL_matslots(UIList):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
slot = item
ma = slot.material
if (ma is not None) and (ma.grease_pencil is not None):
gpcolor = ma.grease_pencil
if ma is None:
return
if (gpcolor := ma.grease_pencil) is None:
return
if self.layout_type in {'DEFAULT', 'COMPACT'}:
row = layout.row(align=True)