diff options
author | Campbell Barton <campbell@blender.org> | 2022-05-12 10:50:11 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-05-12 10:50:11 +0300 |
commit | 59637cf0732a7b085626a8ea2e196710b43c8976 (patch) | |
tree | 58312e48e5d840ddac1e2858f6f3e9a5865535c0 | |
parent | 14175043e53e0ea2c99ea3330fd35c4b1f06273e (diff) | |
parent | 295b6e8230de011dcce62716c76604dd93b9880c (diff) |
Merge branch 'blender-v3.2-release'
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc index fade7f47d9c..0505772c668 100644 --- a/source/blender/editors/transform/transform_snap_object.cc +++ b/source/blender/editors/transform/transform_snap_object.cc @@ -168,8 +168,13 @@ struct SnapObjectContext { /** \name Utilities * \{ */ -/* Mesh used for snapping. - * If nullptr the BMesh should be used. */ +/** + * Mesh used for snapping. + * + * - When the return value is null the `BKE_editmesh_from_object(ob_eval)` should be used. + * - In rare cases there is no evaluated mesh available and a null result doesn't imply an + * edit-mesh, so callers need to account for a null edit-mesh too, see: T96536. + */ static const Mesh *mesh_for_snap(Object *ob_eval, eSnapEditType edit_mode_type, bool *r_use_hide) { const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval); @@ -998,6 +1003,9 @@ static void raycast_obj_fn(SnapObjectContext *sctx, const Mesh *me_eval = mesh_for_snap(ob_eval, edit_mode_type, &use_hide); if (me_eval == nullptr) { BMEditMesh *em = BKE_editmesh_from_object(ob_eval); + if (UNLIKELY(!em)) { /* See #mesh_for_snap doc-string. */ + return; + } BLI_assert_msg(em == BKE_editmesh_from_object(DEG_get_original_object(ob_eval)), "Make sure there is only one pointer for looptris"); retval = raycastEditMesh(sctx, @@ -2696,6 +2704,9 @@ static void snap_obj_fn(SnapObjectContext *sctx, const Mesh *me_eval = mesh_for_snap(ob_eval, edit_mode_type, &use_hide); if (me_eval == nullptr) { BMEditMesh *em = BKE_editmesh_from_object(ob_eval); + if (UNLIKELY(!em)) { /* See #mesh_for_snap doc-string. */ + return; + } BLI_assert_msg(em == BKE_editmesh_from_object(DEG_get_original_object(ob_eval)), "Make sure there is only one pointer for looptris"); retval = snapEditMesh( |