Fix RNA enum item callbacks not checking for NULL context

The NULL context is used to extract items for document generation.
This commit is contained in:
Campbell Barton 2021-04-16 12:06:26 +10:00
parent 43baf38758
commit dc8a43c875
Notes: blender-bot 2023-02-14 05:53:38 +01:00
Referenced by commit ebde6e1852, Fix T88251: "Operator Cheat Sheet" Crash
2 changed files with 13 additions and 1 deletions

View File

@ -665,6 +665,10 @@ static const EnumPropertyItem *outliner_id_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return DummyRNA_NULL_items;
}
EnumPropertyItem item_tmp = {0}, *item = NULL;
int totitem = 0;
int i = 0;

View File

@ -2483,6 +2483,10 @@ const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return rna_enum_transform_orientation_items;
}
Scene *scene;
if (ptr->owner_id && (GS(ptr->owner_id->name) == ID_SCE)) {
scene = (Scene *)ptr->owner_id;
@ -2493,11 +2497,15 @@ const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
return rna_TransformOrientation_impl_itemf(scene, false, r_free);
}
const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *UNUSED(C),
const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *C,
PointerRNA *ptr,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return rna_enum_transform_orientation_items;
}
Scene *scene = (Scene *)ptr->owner_id;
TransformOrientationSlot *orient_slot = ptr->data;
bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);