diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-03-26 16:16:17 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-03-26 16:16:17 +0300 |
commit | 0545a8472946ecc7391f8554c4a214b45952d19e (patch) | |
tree | 31b89ef824f9ec082f04b2f556b2630beae2d6fd /source/blender/draw | |
parent | 1ca1744c29e299f36a83506aec23d9bc99b6e48c (diff) |
Fix Crash In Paint Overlay
The previous implementation tested the normal behavior and ignored some
edge cases. This patch will also test for NULL in all cases
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_paint.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c index 256cc0146dc..4a1aa270de0 100644 --- a/source/blender/draw/engines/overlay/overlay_paint.c +++ b/source/blender/draw/engines/overlay/overlay_paint.c @@ -39,14 +39,15 @@ static bool paint_object_is_rendered_transparent(View3D *v3d, Object *ob) return true; } - if (v3d->shading.color_type == V3D_SHADING_OBJECT_COLOR) { + if (ob && v3d->shading.color_type == V3D_SHADING_OBJECT_COLOR) { return ob->color[3] < 1.0f; } - else if (v3d->shading.color_type == V3D_SHADING_MATERIAL_COLOR) { + else if (ob && ob->type == OB_MESH && ob->data && + v3d->shading.color_type == V3D_SHADING_MATERIAL_COLOR) { Mesh *me = ob->data; for (int i = 0; i < me->totcol; i++) { Material *mat = me->mat[i]; - if (mat->a < 1.0f) { + if (mat && mat->a < 1.0f) { return true; } } |