Fix crash loading factory settings in image paint mode

Loading factory settings left the region NULL, causing the brushes
poll function to crash.
This commit is contained in:
Campbell Barton 2022-07-22 12:25:10 +10:00 committed by Thomas Dinges
parent 9d38a2d21c
commit 2b83f3d521
Notes: blender-bot 2023-02-14 06:45:14 +01:00
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}
}
}
}