From d5ed3de654513f6a53d0db79e912ba179e2833c3 Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Tue, 27 Aug 2019 17:43:37 +0200 Subject: Fix Poly Build crash with empty meshes Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D5609 --- source/blender/editors/mesh/editmesh_polybuild.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index a182bfeb945..21c850160dd 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -136,9 +136,14 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C, invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); + if (!ele_act) { + return OPERATOR_CANCELLED; + } + edbm_selectmode_ensure(vc.scene, vc.em, SCE_SELECT_VERTEX); edbm_flag_disable_all_multi(vc.view_layer, vc.v3d, BM_ELEM_SELECT); + if (ele_act->head.htype == BM_VERT) { BM_vert_select_set(bm, (BMVert *)ele_act, true); } @@ -194,6 +199,10 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C, invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); + if (!ele_act) { + return OPERATOR_CANCELLED; + } + edbm_selectmode_ensure(vc.scene, vc.em, SCE_SELECT_VERTEX); if (ele_act->head.htype == BM_FACE) { -- cgit v1.2.3