Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-11-02 13:37:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-11-02 13:42:47 +0300
commit7b7aba31f24d51c904c76a17ee50608b770e1bc9 (patch)
tree326c218109d49fe285579ace7e4097643a9a8cdc /source/blender/editors/sculpt_paint/paint_ops.c
parent7a9693fa8ba2132e09a892dfa0e60736b741002a (diff)
Fix T46626: Crash generating previews
Brush.toggle_brush was allowed to be an invalid pointer, it worked for the one operator that used it - but in general bad practice, requiring a lookup on every access. Ensure the pointer is kept valid now.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index cee92abe03d..bfeac6219c7 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -407,12 +407,9 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool,
return br;
}
- else if (brush_orig->toggle_brush &&
- BLI_findindex(bmain->brush.first, brush_orig->toggle_brush) != -1)
- {
+ else if (brush_orig->toggle_brush) {
/* if current brush is using the desired tool, try to toggle
- * back to the previously selected brush (if it was set, and
- * if it still exists) */
+ * back to the previously selected brush. */
return brush_orig->toggle_brush;
}
else