Fix: crash in the weight paint poll function

The poll function didn't account for there being
no active region.
This commit is contained in:
Campbell Barton
2025-03-19 14:01:28 +11:00
parent 38ca9b0b87
commit 484aed26d6

View File

@@ -1604,8 +1604,8 @@ static bool weight_paint_poll_ex(bContext *C, bool check_tool)
(BKE_paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != nullptr) &&
(area = CTX_wm_area(C)) && (area->spacetype == SPACE_VIEW3D))
{
ARegion *region = CTX_wm_region(C);
if (ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) {
const ARegion *region = CTX_wm_region(C);
if (region && ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) {
if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) {
return true;
}