Fix T86921: Executing "Operator Cheat Sheet" Crashes Blender

This was only happening without an active object.

The "Operator Cheat Sheet" operator collects info about all operators,
and as part of that executes the callbacks to create dynamic enums. The
callback to enumerate the geometry operators (introduced in
rB370d6e50252b) attribute domains depends on a context object. If this
isn't available, we just have to return `DummyRNA_NULL_items`.

Maniphest Tasks: T86921

Differential Revision: https://developer.blender.org/D10814
This commit is contained in:
Philipp Oeser 2021-03-25 08:41:30 +01:00
parent 0083a7615e
commit 543becac36
Notes: blender-bot 2023-02-13 22:20:49 +01:00
Referenced by issue #86921, Crash of Blender, if "Operator Cheat Sheet" is called
1 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,11 @@ static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C,
bool *r_free)
{
Object *ob = ED_object_context(C);
return rna_enum_attribute_domain_itemf(ob->data, r_free);
if (ob != NULL) {
return rna_enum_attribute_domain_itemf(ob->data, r_free);
}
return DummyRNA_NULL_items;
}
static int geometry_attribute_add_exec(bContext *C, wmOperator *op)