Fix T56675: Crash when snapping Cursor to selected a Bone in Edit Mode.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 4 Sep 2018 07:12:54 +0000 (09:12 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 4 Sep 2018 07:13:21 +0000 (09:13 +0200)
Seriously...

source/blender/editors/space_view3d/view3d_snap.c

index c33d71b97752f0f73d0909093f8766c1bb34ef24..1c2415c67b94491130cae32d4aff4d68f799a187 100644 (file)
@@ -621,10 +621,14 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
                Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
                for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
                        obedit = objects[ob_index];
-                       BMEditMesh *em = BKE_editmesh_from_object(obedit);
 
-                       if (em->bm->totvertsel == 0) {
-                               continue;
+                       /* We can do that quick check for meshes only... */
+                       if (obedit->type == OB_MESH) {
+                               BMEditMesh *em = BKE_editmesh_from_object(obedit);
+
+                               if (em->bm->totvertsel == 0) {
+                                       continue;
+                               }
                        }
 
                        if (ED_transverts_check_obedit(obedit)) {