diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-03-12 12:17:27 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-03-12 12:17:48 +0300 |
commit | 8363e10cccbf437bc7d9e816c9ec4de834d475b8 (patch) | |
tree | 7d1aead746eebef4c11e3808b3d6cf8b5c2a5575 /source/blender | |
parent | 21f016f01062a26c4de18d4b775d71a8bf1d84ce (diff) |
Fix T74659: Seaching for operator crashes Blender
The poll function was not checking the paint pointer.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 6fe1ba0b817..fed3c2f03a4 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -377,17 +377,6 @@ static void PALETTE_OT_extract_from_image(wmOperatorType *ot) } /* Sort Palette color by Hue and Saturation. */ -static bool palette_sort_poll(bContext *C) -{ - Paint *paint = BKE_paint_get_active_from_context(C); - Palette *palette = paint->palette; - if (palette) { - return true; - } - - return false; -} - static int palette_sort_exec(bContext *C, wmOperator *op) { const int type = RNA_enum_get(op->ptr, "type"); @@ -477,7 +466,7 @@ static void PALETTE_OT_sort(wmOperatorType *ot) /* api callbacks */ ot->exec = palette_sort_exec; - ot->poll = palette_sort_poll; + ot->poll = palette_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -522,7 +511,7 @@ static void PALETTE_OT_color_move(wmOperatorType *ot) /* api callbacks */ ot->exec = palette_color_move_exec; - ot->poll = palette_sort_poll; + ot->poll = palette_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -531,17 +520,6 @@ static void PALETTE_OT_color_move(wmOperatorType *ot) } /* Join Palette swatches. */ -static bool palette_join_poll(bContext *C) -{ - Paint *paint = BKE_paint_get_active_from_context(C); - Palette *palette = paint->palette; - if (palette) { - return true; - } - - return false; -} - static int palette_join_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); @@ -599,7 +577,7 @@ static void PALETTE_OT_join(wmOperatorType *ot) /* api callbacks */ ot->exec = palette_join_exec; - ot->poll = palette_join_poll; + ot->poll = palette_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |