diff options
author | Jacques Lucke <jacques@blender.org> | 2021-07-23 17:15:18 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-07-23 17:15:18 +0300 |
commit | eb434778511070238ec189c8929c9b267842606a (patch) | |
tree | 548172286e198439e5d2aa9125021621947413e8 /source/blender/blenkernel/intern | |
parent | 239a74a130bdb917bed8889f518b4aa54a7b96c2 (diff) |
Fix T89393: crash when selecting edges when geometry nodes has "on cage" turned on
The core problem is that the geometry nodes modifier sometimes support
"mapping" (i.e. it remembers which new vertices correspond to edit mode
vertices) and sometimes it does not, depending on what the nodes are doing.
Also see rB07ce9910f7cc.
The solution here is that the fallback case in `BKE_mesh_foreach_mapped_edge`
does not call the callback with "invalid" indices.
Differential Revision: https://developer.blender.org/D12007
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_iterators.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh_iterators.c b/source/blender/blenkernel/intern/mesh_iterators.c index 5ecf5ae316d..7a776b0ecb7 100644 --- a/source/blender/blenkernel/intern/mesh_iterators.c +++ b/source/blender/blenkernel/intern/mesh_iterators.c @@ -95,9 +95,14 @@ void BKE_mesh_foreach_mapped_vert(Mesh *mesh, } } -/* Copied from cdDM_foreachMappedEdge */ +/** + * Copied from #cdDM_foreachMappedEdge. + * \param tot_edges: Number of original edges. Used to avoid calling the callback with invalid + * edge indices. + */ void BKE_mesh_foreach_mapped_edge( Mesh *mesh, + const int tot_edges, void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]), void *userData) { @@ -138,7 +143,7 @@ void BKE_mesh_foreach_mapped_edge( func(userData, orig, mv[med->v1].co, mv[med->v2].co); } } - else { + else if (mesh->totedge == tot_edges) { for (int i = 0; i < mesh->totedge; i++, med++) { func(userData, i, mv[med->v1].co, mv[med->v2].co); } |