diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-22 05:25:10 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2022-07-26 17:48:22 +0300 |
commit | 2b83f3d5216374aa5fca6114dca26c2172dedd2b (patch) | |
tree | 7c4f5fff284293d67bbb6492ebb0cd6ccceef6f3 /source | |
parent | 9d38a2d21c97e30321b911ec1f1843f9d0ad87c2 (diff) |
Fix crash loading factory settings in image paint mode
Loading factory settings left the region NULL, causing the brushes
poll function to crash.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.cc b/source/blender/editors/sculpt_paint/paint_image.cc index e726fd3f338..9c37bbed870 100644 --- a/source/blender/editors/sculpt_paint/paint_image.cc +++ b/source/blender/editors/sculpt_paint/paint_image.cc @@ -276,10 +276,11 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) (ID_IS_LINKED(sima->image) || ID_IS_OVERRIDE_LIBRARY(sima->image))) { return false; } - ARegion *region = CTX_wm_region(C); - - if ((sima->mode == SI_MODE_PAINT) && region->regiontype == RGN_TYPE_WINDOW) { - return true; + if (sima->mode == SI_MODE_PAINT) { + const ARegion *region = CTX_wm_region(C); + if (region->regiontype == RGN_TYPE_WINDOW) { + return true; + } } } } |