Fix crash in grease pencil snap without a window region
Add window region check to the poll function.
This commit is contained in:
@@ -3359,8 +3359,16 @@ static bool grease_pencil_snap_poll(bContext *C)
|
||||
return false;
|
||||
}
|
||||
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
return (area != nullptr) && (area->spacetype == SPACE_VIEW3D);
|
||||
const ScrArea *area = CTX_wm_area(C);
|
||||
if (!(area && area->spacetype == SPACE_VIEW3D)) {
|
||||
return false;
|
||||
}
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static wmOperatorStatus grease_pencil_snap_to_grid_exec(bContext *C, wmOperator * /*op*/)
|
||||
|
||||
Reference in New Issue
Block a user