Fix T58221: Spin tool w/ merge first/last crashes
authorCampbell Barton <ideasman42@gmail.com>
Tue, 5 Feb 2019 02:25:55 +0000 (13:25 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 5 Feb 2019 02:30:07 +0000 (13:30 +1100)
Spinning geometry that included non boundary/wire edges
crashed when merge first/last enabled.

source/blender/bmesh/operators/bmo_dupe.c

index 5129212f49bb5ff03015ae63e55b2a2f1b1774b3..3a07c81129f36475faf12daf22b618ab4c8a155d 100644 (file)
@@ -550,13 +550,14 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
                                        if (elem_array[i]->head.htype == BM_EDGE) {
                                                BMEdge *e_src = (BMEdge *)elem_array[i];
                                                BMEdge *e_dst = BM_edge_find_double(e_src);
-                                               BM_edge_splice(bm, e_dst, e_src);
-                                               elem_array_len--;
-                                               elem_array[i] = elem_array[elem_array_len];
-                                       }
-                                       else {
-                                               i++;
+                                               if (e_dst != NULL) {
+                                                       BM_edge_splice(bm, e_dst, e_src);
+                                                       elem_array_len--;
+                                                       elem_array[i] = elem_array[elem_array_len];
+                                                       continue;
+                                               }
                                        }
+                                       i++;
                                }
                                /* Full copies of faces may cause overlap. */
                                for (int i = 0; i < elem_array_len; ) {