Fix assert triggered when snapping to evaluated geometry of a Curve

Curves can have a Mesh evaluated, but only objects of type Mesh have
EditMesh.

This bug is harmless because `sctx->editmesh_caches.remove(value)` only
works with pointers and `BKE_editmesh_from_object(ob_eval)`, even though
it doesn't actually return a `BMEditMesh`, it still returns a pointer
that doesn't exist as a key.
This commit is contained in:
Germano Cavalcante 2022-06-08 20:41:56 -03:00
parent 530f2abb9b
commit 8a02696724
1 changed files with 4 additions and 2 deletions

View File

@ -283,8 +283,10 @@ static SnapData_Mesh *snap_object_data_mesh_get(SnapObjectContext *sctx,
}
}
else {
/* Any existing #SnapData_EditMesh is now invalid. */
sctx->editmesh_caches.remove(BKE_editmesh_from_object(ob_eval));
if (ob_eval->type == OB_MESH) {
/* Any existing #SnapData_EditMesh is now invalid. */
sctx->editmesh_caches.remove(BKE_editmesh_from_object(ob_eval));
}
std::unique_ptr<SnapData_Mesh> sod_ptr = std::make_unique<SnapData_Mesh>();
sod = sod_ptr.get();