Fix T88251: "Operator Cheat Sheet" Crash

Caused by {rB919558854d62}.

Same fix as in {rBdc8a43c8755a} -- let RNA enum item callbacks check
for NULL context.

The NULL context is used to extract items for document generation.

Maniphest Tasks: T88251

Differential Revision: https://developer.blender.org/D11391
This commit is contained in:
Philipp Oeser 2021-05-25 17:46:17 +02:00
parent 0f7becece7
commit ebde6e1852
Notes: blender-bot 2023-02-14 08:10:06 +01:00
Referenced by issue #88251, "Operator Cheat Sheet" Crash 2.93.0
2 changed files with 12 additions and 4 deletions

View File

@ -52,12 +52,16 @@ static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
Object *ob = ED_object_context(C);
if (ob != NULL) {
return rna_enum_attribute_domain_itemf(ob->data, r_free);
if (C == NULL) {
return DummyRNA_NULL_items;
}
return DummyRNA_NULL_items;
Object *ob = ED_object_context(C);
if (ob == NULL) {
return DummyRNA_NULL_items;
}
return rna_enum_attribute_domain_itemf(ob->data, r_free);
}
static int geometry_attribute_add_exec(bContext *C, wmOperator *op)

View File

@ -3985,6 +3985,10 @@ static const EnumPropertyItem *vgroup_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return DummyRNA_NULL_items;
}
Object *ob = ED_object_context(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
EnumPropertyItem *item = NULL;