Fix T97774: don't crash when no brush is selected

This commit is contained in:
Jacques Lucke 2022-05-05 12:51:14 +02:00
parent 611b82621d
commit bff9bf728e
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #97774, Hair Curves crash if no tool is selected
1 changed files with 6 additions and 0 deletions

View File

@ -149,6 +149,12 @@ static void stroke_done(const bContext *C, PaintStroke *stroke)
static int sculpt_curves_stroke_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
if (brush == nullptr) {
return OPERATOR_CANCELLED;
}
SculptCurvesBrushStrokeData *op_data = MEM_new<SculptCurvesBrushStrokeData>(__func__);
op_data->stroke = paint_stroke_new(C,
op,