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:
authorAntonioya <blendergit@gmail.com>2019-03-28 18:48:32 +0300
committerAntonioya <blendergit@gmail.com>2019-03-28 18:48:32 +0300
commit1dddb47e48ca0661d343a21100de8219bf85ae6a (patch)
treea72933bcd2953423092656a624df8d7ce50a2eab /source/blender/editors/gpencil/gpencil_fill.c
parent1be2888bf0210e510ca65a7b86e5350ea85ab9f1 (diff)
Fix T63052: Crash on "Grease Pencil Fill" without Grease Pencil Object
Changed poll function to verify if the context is valid. Also cleanup return values.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_fill.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index acbf329b783..5966684d30c 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1150,19 +1150,27 @@ static void gpencil_fill_draw_3d(const bContext *C, ARegion *UNUSED(ar), void *a
/* check if context is suitable for filling */
static bool gpencil_fill_poll(bContext *C)
{
+ Object *obact = CTX_data_active_object(C);
+
if (ED_operator_regionactive(C)) {
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype == SPACE_VIEW3D) {
- return 1;
+ if ((obact == NULL) ||
+ (obact->type != OB_GPENCIL) ||
+ (obact->mode != OB_MODE_PAINT_GPENCIL)) {
+ return false;
+ }
+
+ return true;
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not valid for filling operator");
- return 0;
+ return false;
}
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not set");
- return 0;
+ return true;
}
}