Sculpt: fix missing null pointer check

in workbench_engine.c
This commit is contained in:
Joseph Eagar 2022-04-21 00:58:19 -07:00
parent c342b3cede
commit 01333cb47f
1 changed files with 10 additions and 6 deletions

View File

@ -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) {