Fix T39974: Popups lead to crash if 'UNDO' isn't set

This isn't supported, raise an error instead
This commit is contained in:
Campbell Barton 2014-05-01 05:27:43 +10:00
parent 0309a7b9a9
commit 4b75956330
Notes: blender-bot 2023-02-14 20:07:36 +01:00
Referenced by issue blender/blender-addons#39974, Popups lead to crash if operator has 'UNDO' options not set and properties are manipulated
1 changed files with 8 additions and 0 deletions

View File

@ -1588,6 +1588,14 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op,
return OPERATOR_CANCELLED;
}
if (do_redo) {
if ((op->type->flag & OPTYPE_UNDO) == 0) {
BKE_reportf(op->reports, RPT_ERROR,
"Operator '%s' does not have undo enabled, incorrect invoke function", op->type->idname);
return OPERATOR_CANCELLED;
}
}
/* if we don't have global undo, we can't do undo push for automatic redo,
* so we require manual OK clicking in this popup */
if (!do_redo || !(U.uiflag & USER_GLOBALUNDO))