Commit: efe90944eee8d1563b1a035dc5f16821263b0ce6
Author: Brecht Van Lommel
Date:   Tue Jul 13 15:16:06 2021 +0200
Branches: master
https://developer.blender.org/rBefe90944eee8d1563b1a035dc5f16821263b0ce6

Fix crash displaying invalid enum value with translations enabled

Found loading a cycles-x .blend file saved with different integer values for
enum items.

===================================================================

M       source/blender/makesrna/intern/rna_access.c

===================================================================

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);
     }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to