diff --git a/source/blender/editors/sculpt_paint/paint_mask.cc b/source/blender/editors/sculpt_paint/paint_mask.cc index dfca5553b00..c321e07fd13 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.cc +++ b/source/blender/editors/sculpt_paint/paint_mask.cc @@ -1036,6 +1036,7 @@ static void sculpt_gesture_trim_geometry_generate(gesture::GestureData *gesture_ ARegion *region = vc->region; const int tot_screen_points = gesture_data->tot_gesture_points; + BLI_assert(tot_screen_points > 1); float(*screen_points)[2] = gesture_data->gesture_points; const int trim_totverts = tot_screen_points * 2; diff --git a/source/blender/editors/sculpt_paint/sculpt_gesture.cc b/source/blender/editors/sculpt_paint/sculpt_gesture.cc index e5d6a4d095b..9504db2c7a1 100644 --- a/source/blender/editors/sculpt_paint/sculpt_gesture.cc +++ b/source/blender/editors/sculpt_paint/sculpt_gesture.cc @@ -104,6 +104,12 @@ GestureData *init_from_lasso(bContext *C, wmOperator *op) return nullptr; } + /* A single point is equally as invalid for a lasso gesture as no points. */ + if (mcoords_len == 1) { + MEM_freeN((void *)mcoords); + return nullptr; + } + gesture_data->lasso.projviewobjmat = ED_view3d_ob_project_mat_get(gesture_data->vc.rv3d, gesture_data->vc.obact); BLI_lasso_boundbox(&gesture_data->lasso.boundbox, mcoords, mcoords_len);