Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-07-13 16:16:06 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-07-14 14:54:52 +0300
commitefe90944eee8d1563b1a035dc5f16821263b0ce6 (patch)
tree3ac07cf7ba2cb344fbdbd766a3742c1e157bd22d /source/blender/makesrna
parent765406cb5115c191114753a2dbed74d53ddcb3a1 (diff)
Fix crash displaying invalid enum value with translations enabled
Found loading a cycles-x .blend file saved with different integer values for enum items.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_access.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index a0a84bf4fc9..b4d0fcdee31 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -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;
-
- result = RNA_property_enum_item_from_value(C, ptr, prop, value, r_item);
+ const bool 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);
}