From 6ed49857a4408bf413f4bf626229aa00d6c8cad7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 4 Sep 2009 08:49:11 +0000 Subject: poll functions to stop crashing when running operators in an invalid context. --- source/blender/editors/space_console/console_ops.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/editors/space_console') diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index f8dbe0c3dd4..3d0d284b501 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -234,6 +234,11 @@ static int console_edit_poll(bContext *C) return 1; } +static int console_poll(bContext *C) +{ + return (CTX_wm_space_console(C) != NULL); +} + /* static funcs for text editing */ @@ -695,6 +700,7 @@ void CONSOLE_OT_zoom(wmOperatorType *ot) /* api callbacks */ ot->exec= zoom_exec; + ot->poll= console_poll; /* flags */ /* ot->flag= OPTYPE_REGISTER; */ /* super annoying */ -- cgit v1.2.3