Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-07-01 09:44:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-07-01 09:50:28 +0300
commit9f634a195d1f2bd4c16332fa513dfeffa0301977 (patch)
treea0297ddaa0b8300e725e3ce69da37c0029dc81e8
parent8c4703127ad1bd857b8b1b39960a3da2ffa36ca6 (diff)
Fix crash drawing non-mesh objects with vertex color
Missing NULL check in f7bbc7cdbb6cb
-rw-r--r--source/blender/draw/engines/workbench/workbench_engine.c21
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;
}
}