From 6753882e42282ccf9dea49bdef2fc5455d852710 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Nov 2010 15:59:09 +0000 Subject: bugfix [#24009] Crash when switching area types and performing ops --- source/blender/editors/gpencil/gpencil_paint.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 23e2755613c..d42e63bf354 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -141,8 +141,20 @@ static void gp_session_validatebuffer(tGPsdata *p); /* check if context is suitable for drawing */ static int gpencil_draw_poll (bContext *C) { - /* check if current context can support GPencil data */ - return (gpencil_data_get_pointers(C, NULL) != NULL); + if(ED_operator_regionactive(C)) { + /* check if current context can support GPencil data */ + if(gpencil_data_get_pointers(C, NULL) != NULL) { + return 1; + } + else { + CTX_wm_operator_poll_msg_set(C, "failed to find grease pencil data to draw into"); + } + } + else { + CTX_wm_operator_poll_msg_set(C, "active region not set"); + } + + return 0; } /* check if projecting strokes into 3d-geometry in the 3D-View */ -- cgit v1.2.3