Fix crash running "Edit Voxel Size" operator outside of a main 3D View region

Accessed `RegionView3D` data from context, which of course would only be set if
actually executed from a main 3D View region.
This commit is contained in:
Julian Eisel
2020-06-08 15:42:50 +02:00
parent e3396d8bfc
commit bf4198cdaf

View File

@@ -584,6 +584,11 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_RUNNING_MODAL;
}
static bool voxel_size_edit_poll(bContext *C)
{
return CTX_wm_region_view3d(C) && object_remesh_poll(C);
}
void OBJECT_OT_voxel_size_edit(wmOperatorType *ot)
{
/* identifiers */
@@ -592,7 +597,7 @@ void OBJECT_OT_voxel_size_edit(wmOperatorType *ot)
ot->idname = "OBJECT_OT_voxel_size_edit";
/* api callbacks */
ot->poll = object_remesh_poll;
ot->poll = voxel_size_edit_poll;
ot->invoke = voxel_size_edit_invoke;
ot->modal = voxel_size_edit_modal;
ot->cancel = voxel_size_edit_cancel;