Fix crash in RNA when accessing empty property_tags list

E.g. running `bpy.context.active_object.cycles.bl_rna.property` in the
console would crash.

Thanks @lijenstina for reporting!
This commit is contained in:
Julian Eisel
2017-12-19 20:53:19 +01:00
parent 433c74d9f7
commit b0d61ea770

View File

@@ -335,7 +335,7 @@ static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, Poi
/* here ptr->data should always be the same as iter->parent.type */
StructRNA *srna = (StructRNA *)ptr->data;
const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna);
unsigned int tag_count = RNA_enum_items_count(tag_defines);
unsigned int tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0;
rna_iterator_array_begin(iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL);
}