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>2012-04-24 16:27:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-24 16:27:38 +0400
commitbde288d6568fb300892ba15ee3e79bdd35df3b99 (patch)
treebdafada0e33a20edaacdca8fd1ceae513aaa51c0
parente06e338e205934af91ead0869dbc9ffa29787988 (diff)
crash fix for brush select when no object is active
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 3bc3c7a9224..b5d6f20aa79 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -254,12 +254,18 @@ static int brush_select_exec(bContext *C, wmOperator *op)
size_t tool_offset;
if (paint_mode == OB_MODE_ACTIVE) {
- /* select current paint mode */
- paint_mode = CTX_data_active_object(C)->mode &
- (OB_MODE_SCULPT |
- OB_MODE_VERTEX_PAINT |
- OB_MODE_WEIGHT_PAINT |
- OB_MODE_TEXTURE_PAINT);
+ Object *ob = CTX_data_active_object(C);
+ if (ob) {
+ /* select current paint mode */
+ paint_mode = ob->mode &
+ (OB_MODE_SCULPT |
+ OB_MODE_VERTEX_PAINT |
+ OB_MODE_WEIGHT_PAINT |
+ OB_MODE_TEXTURE_PAINT);
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
}
switch (paint_mode) {