diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-01 09:44:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-01 09:50:28 +0300 |
commit | 9f634a195d1f2bd4c16332fa513dfeffa0301977 (patch) | |
tree | a0297ddaa0b8300e725e3ce69da37c0029dc81e8 /source/blender/draw/engines | |
parent | 8c4703127ad1bd857b8b1b39960a3da2ffa36ca6 (diff) |
Fix crash drawing non-mesh objects with vertex color
Missing NULL check in f7bbc7cdbb6cb
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_engine.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index 0eef22655d3..c8dde4d513b 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -251,18 +251,17 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd, const bool is_texpaint_mode = is_active && (wpd->ctx_mode == CTX_MODE_PAINT_TEXTURE); const bool is_vertpaint_mode = is_active && (wpd->ctx_mode == CTX_MODE_PAINT_VERTEX); - if ((color_type == V3D_SHADING_TEXTURE_COLOR) && (ob->dt < OB_TEXTURE)) { - color_type = V3D_SHADING_MATERIAL_COLOR; - } - /* Disable color mode if data layer is unavailable. */ - if ((color_type == V3D_SHADING_TEXTURE_COLOR) && (me == NULL || me->mloopuv == NULL)) { - color_type = V3D_SHADING_MATERIAL_COLOR; - } - if (color_type == V3D_SHADING_VERTEX_COLOR) { - if (me == NULL) { - color_type = V3D_SHADING_OBJECT_COLOR; + if (color_type == V3D_SHADING_TEXTURE_COLOR) { + if (ob->dt < OB_TEXTURE) { + color_type = V3D_SHADING_MATERIAL_COLOR; } - if (!CustomData_has_layer(&me->vdata, CD_PROP_COLOR)) { + else if ((me == NULL) || (me->mloopuv == NULL)) { + /* Disable color mode if data layer is unavailable. */ + color_type = V3D_SHADING_MATERIAL_COLOR; + } + } + else if (color_type == V3D_SHADING_VERTEX_COLOR) { + if ((me == NULL) || !CustomData_has_layer(&me->vdata, CD_PROP_COLOR)) { color_type = V3D_SHADING_OBJECT_COLOR; } } |