[Bf-blender-cvs] [bff9bf728e1] master: Fix T97774: don't crash when no brush is selected

Jacques Lucke noreply at git.blender.org
Thu May 5 12:52:28 CEST 2022


Commit: bff9bf728e1623ac01ef0230d86832592796b6d3
Author: Jacques Lucke
Date:   Thu May 5 12:51:14 2022 +0200
Branches: master
https://developer.blender.org/rBbff9bf728e1623ac01ef0230d86832592796b6d3

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

===================================================================

M	source/blender/editors/sculpt_paint/curves_sculpt_ops.cc

===================================================================

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index d773b4e70a7..d8713c8eb1d 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -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,



More information about the Bf-blender-cvs mailing list