Fix: Displaying any point cloud in the viewport causes crash

Caused by rBf75449b5f2b04b79, which was missing a null check when
attempting to extract a `CustomData` pointer from an mesh that might
be null if the object isn't a mesh object. The commit added null checks
elsewhere, so simply adding them here is a straightforward fix.

Fixes T95526, T95539
This commit is contained in:
Hans Goudey 2022-02-05 17:52:04 -06:00
parent c24b2cdebf
commit 59a8bdd48c
Notes: blender-bot 2023-02-14 06:42:54 +01:00
Referenced by issue #95539, Crash when use "distribute points on faces" node
Referenced by issue #95526, "Instances to Points" crashes Blender
Referenced by issue #95517, Crash When Adding Volume Object While in Workbench
1 changed files with 2 additions and 2 deletions

View File

@ -272,8 +272,8 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd,
{
eV3DShadingColorType color_type = wpd->shading.color_type;
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
const CustomData *ldata = workbench_mesh_get_loop_custom_data(me);
const CustomData *vdata = workbench_mesh_get_vert_custom_data(me);
const CustomData *ldata = (me == NULL) ? NULL : workbench_mesh_get_loop_custom_data(me);
const CustomData *vdata = (me == NULL) ? NULL : workbench_mesh_get_vert_custom_data(me);
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_active = (ob == draw_ctx->obact);