From 33da997193b570f12db57fabcbe02e7283b7bbfc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 26 Mar 2020 12:49:10 +1100 Subject: Fix crashes from various missing checks in operator poll functions Issues exposed by 'bl_run_operators.py' utility. --- source/blender/editors/gpencil/gpencil_convert.c | 2 +- source/blender/editors/gpencil/gpencil_edit.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 1c55c3b5a8f..6e2c6936b1a 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -1755,7 +1755,7 @@ void GPENCIL_OT_convert(wmOperatorType *ot) static bool image_to_gpencil_poll(bContext *C) { SpaceLink *sl = CTX_wm_space_data(C); - if (sl->spacetype == SPACE_IMAGE) { + if ((sl != NULL) && (sl->spacetype == SPACE_IMAGE)) { return true; } diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 83ecb3ab42f..1b42334499e 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1379,7 +1379,8 @@ void GPENCIL_OT_copy(wmOperatorType *ot) static bool gp_strokes_paste_poll(bContext *C) { - if (CTX_wm_area(C)->spacetype != SPACE_VIEW3D) { + ScrArea *sa = CTX_wm_area(C); + if (!((sa != NULL) && (sa->spacetype == SPACE_VIEW3D))) { return false; } /* 1) Must have GP datablock to paste to -- cgit v1.2.3