[Bf-blender-cvs] [59a8bdd48ce] blender-v3.1-release: Fix: Displaying any point cloud in the viewport causes crash

Hans Goudey noreply at git.blender.org
Sun Feb 6 00:52:16 CET 2022


Commit: 59a8bdd48ce1eac7cf51249efacdf1a601afee32
Author: Hans Goudey
Date:   Sat Feb 5 17:52:04 2022 -0600
Branches: blender-v3.1-release
https://developer.blender.org/rB59a8bdd48ce1eac7cf51249efacdf1a601afee32

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

===================================================================

M	source/blender/draw/engines/workbench/workbench_engine.c

===================================================================

diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c
index 4a8c248a8e9..0dfc3c4b119 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -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);



More information about the Bf-blender-cvs mailing list