Fix crash displaying invalid enum value with translations enabled

Found loading a cycles-x .blend file saved with different integer values for
enum items.
This commit is contained in:
Brecht Van Lommel 2021-07-13 15:16:06 +02:00
parent 765406cb51
commit efe90944ee
1 changed files with 2 additions and 4 deletions

View File

@ -2026,11 +2026,9 @@ bool RNA_property_enum_item_from_value(
bool RNA_property_enum_item_from_value_gettexted(
bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, EnumPropertyItem *r_item)
{
bool result;
const bool result = RNA_property_enum_item_from_value(C, ptr, prop, value, r_item);
result = RNA_property_enum_item_from_value(C, ptr, prop, value, r_item);
if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
if (result && !(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
if (BLT_translate_iface()) {
r_item->name = BLT_pgettext(prop->translation_context, r_item->name);
}