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:
authorCampbell Barton <ideasman42@gmail.com>2011-05-18 13:26:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-18 13:26:07 +0400
commit0454c817ef3c11c94359a6ebded99e4181d42ef7 (patch)
treec68aee5b7ec4566322bcfece870fd8dd09a470a6 /source/blender/makesrna/intern/rna_access.c
parentebe47add0816831ac0d1ce77a47a09da60d4af59 (diff)
fix a crash when getting the value of an enum.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index a89d52e9fca..36694e1adc1 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1107,21 +1107,26 @@ int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, con
{
EnumPropertyItem *item, *item_array;
int free, found;
-
+
RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
-
- for(item= item_array; item->identifier; item++) {
- if(item->identifier[0] && strcmp(item->identifier, identifier)==0) {
- *value = item->value;
- break;
+
+ if(item_array) {
+ for(item= item_array; item->identifier; item++) {
+ if(item->identifier[0] && strcmp(item->identifier, identifier)==0) {
+ *value = item->value;
+ break;
+ }
}
- }
-
- found= (item->identifier != NULL); /* could be alloc'd, assign before free */
- if(free)
- MEM_freeN(item_array);
+ found= (item->identifier != NULL); /* could be alloc'd, assign before free */
+ if(free) {
+ MEM_freeN(item_array);
+ }
+ }
+ else {
+ found= 0;
+ }
return found;
}