Fix tool system Python errors if there is no active object.

This commit is contained in:
Brecht Van Lommel 2019-04-16 12:18:28 +02:00
parent 0ca9ce21ab
commit f45b91a1c5

@ -957,7 +957,7 @@ class _defs_vertex_paint:
if context is None:
return True
ob = context.active_object
return (ob.type == 'MESH' and
return (ob and ob.type == 'MESH' and
(ob.data.use_paint_mask or
ob.data.use_paint_mask_vertex))
@ -979,7 +979,7 @@ class _defs_texture_paint:
if context is None:
return True
ob = context.active_object
return (ob.type == 'MESH' and
return (ob and ob.type == 'MESH' and
(ob.data.use_paint_mask))
@staticmethod
@ -1000,7 +1000,7 @@ class _defs_weight_paint:
if context is None:
return True
ob = context.active_object
return (ob.type == 'MESH' and
return (ob and ob.type == 'MESH' and
(ob.data.use_paint_mask or
ob.data.use_paint_mask_vertex))