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
path: root/source
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-02-17 15:15:42 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-02-17 15:19:39 +0400
commit280f9d3b398a073d7a2d64c89d5b6b69939f2f30 (patch)
treeb490945bd4fb83abc9029f0fbac39aac09c49195 /source
parentd39ffd72174c28a66c3a8d97054d67cc372f088b (diff)
Fix T38650: Crash from enum item functions returning NULL instead of a
single terminator item. Ideally no enum item function should return NULL, but since this is very common and an intuitive mistake, better handle that case gracefully in the RNA access function.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_access.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index a3dee924c0b..2d8f8eb5c45 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1222,18 +1222,19 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En
*r_free = false;
if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
- int tot = 0;
-
if (prop->flag & PROP_ENUM_NO_CONTEXT)
*item = eprop->itemf(NULL, ptr, prop, r_free);
else
*item = eprop->itemf(C, ptr, prop, r_free);
- if (r_totitem) {
- if (*item) {
- for (; (*item)[tot].identifier; tot++) ;
- }
+ if ((*item) == NULL) {
+ int tot = 0;
+ RNA_enum_item_end(item, &tot);
+ }
+ if (r_totitem) {
+ int tot = 0;
+ for (; (*item)[tot].identifier; tot++) ;
*r_totitem = tot;
}