diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-04-21 10:58:19 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-04-21 10:58:45 +0300 |
commit | 01333cb47f83d19a62b5c96f2a69cb8a7c4ae7c3 (patch) | |
tree | 12d034dd48411ca94808a4ff43ec97d9e31a0661 | |
parent | c342b3cede9476b4279c0f13f1ba2b068fed4cb9 (diff) |
Sculpt: fix missing null pointer check
in workbench_engine.c
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_engine.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index 23543e6bfec..fb20bde2f65 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -271,13 +271,17 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd, BKE_pbvh_is_drawing_set(ob->sculpt->pbvh, is_sculpt_pbvh); } - const CustomData *cd_vdata = workbench_mesh_get_vert_custom_data(me); - const CustomData *cd_ldata = workbench_mesh_get_loop_custom_data(me); + bool has_color = false; - bool has_color = (CustomData_has_layer(cd_vdata, CD_PROP_COLOR) || - CustomData_has_layer(cd_vdata, CD_PROP_BYTE_COLOR) || - CustomData_has_layer(cd_ldata, CD_PROP_COLOR) || - CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR)); + if (me) { + const CustomData *cd_vdata = workbench_mesh_get_vert_custom_data(me); + const CustomData *cd_ldata = workbench_mesh_get_loop_custom_data(me); + + has_color = (CustomData_has_layer(cd_vdata, CD_PROP_COLOR) || + CustomData_has_layer(cd_vdata, CD_PROP_BYTE_COLOR) || + CustomData_has_layer(cd_ldata, CD_PROP_COLOR) || + CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR)); + } if (color_type == V3D_SHADING_TEXTURE_COLOR) { if (ob->dt < OB_TEXTURE) { |