forked from bartvdbraak/blender
accessing rna 'default_flag' attribute of a non enum-flag could crash. eg.
bpy.types.Modifier.bl_rna.properties["type"].default_flag now check the default/default_flag match the enum property they are used with.
This commit is contained in:
parent
7025f13894
commit
985e77b723
@ -746,7 +746,7 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
|
|||||||
return ((StringPropertyRNA*)prop)->maxlength;
|
return ((StringPropertyRNA*)prop)->maxlength;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
|
static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, int *free)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
||||||
EnumPropertyRNA *eprop;
|
EnumPropertyRNA *eprop;
|
||||||
@ -754,6 +754,11 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA
|
|||||||
rna_idproperty_check(&prop, ptr);
|
rna_idproperty_check(&prop, ptr);
|
||||||
eprop= (EnumPropertyRNA*)prop;
|
eprop= (EnumPropertyRNA*)prop;
|
||||||
|
|
||||||
|
/* incompatible default attributes */
|
||||||
|
if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if( (eprop->itemf == NULL) ||
|
if( (eprop->itemf == NULL) ||
|
||||||
(eprop->itemf == rna_EnumProperty_default_itemf) ||
|
(eprop->itemf == rna_EnumProperty_default_itemf) ||
|
||||||
(ptr->type == &RNA_EnumProperty) ||
|
(ptr->type == &RNA_EnumProperty) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user