diff options
author | Antonioya <blendergit@gmail.com> | 2019-05-05 10:10:44 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-05-05 10:10:44 +0300 |
commit | 47df163b6cd9074d1e41e268911cbab943fb6a80 (patch) | |
tree | afcd3c25268042cc84a87f0c5c37c7169482a058 /source/blender/blenkernel/intern/gpencil.c | |
parent | ab9731ccea592bbf8b6931803671b5172a19f7f9 (diff) |
GPencil: Verify brush is valid for grease pencil
Usually the brush type is correct, but for some old files the brush could be a not valid type. In this case, returns the object active material.
This is related to T61413
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index c82b2c377fa..439005ca1b4 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1109,7 +1109,8 @@ Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *n /* Returns the material for a brush with respect to its pinned state. */ Material *BKE_gpencil_object_material_get_from_brush(Object *ob, Brush *brush) { - if ((brush) && (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) { + if ((brush) && (brush->gpencil_settings) && + (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) { Material *ma = BKE_gpencil_brush_material_get(brush); return ma; } |