diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-30 13:56:59 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-30 14:06:17 +0300 |
commit | 524d9a3e2fa1821d0f846877ecb3936b7c3794dd (patch) | |
tree | 8440c7742469618a5e06944da53504af2aeedc5a /source/blender/editors/screen | |
parent | 34e30baedf7eee625deeba3ab1209be7efbaaf04 (diff) |
Fix error in operator poll functions
- PALETTE_OT_color_add: crashed without a brush.
- SCREEN_OT_actionzone: crashed without a window.
- PREFERENCES_OT_studiolight_show: exception when opening prefs failed.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 3618b933443..c069b3c6292 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -723,15 +723,16 @@ typedef struct sActionzoneData { static bool actionzone_area_poll(bContext *C) { wmWindow *win = CTX_wm_window(C); - bScreen *screen = WM_window_get_active_screen(win); - - if (screen && win && win->eventstate) { - const int *xy = &win->eventstate->xy[0]; + if (win && win->eventstate) { + bScreen *screen = WM_window_get_active_screen(win); + if (screen) { + const int *xy = &win->eventstate->xy[0]; - LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { - LISTBASE_FOREACH (AZone *, az, &area->actionzones) { - if (BLI_rcti_isect_pt_v(&az->rect, xy)) { - return true; + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (AZone *, az, &area->actionzones) { + if (BLI_rcti_isect_pt_v(&az->rect, xy)) { + return true; + } } } } |