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:
Diffstat (limited to 'source/blender/python/intern/bpy_capi_utils.c')
-rw-r--r--source/blender/python/intern/bpy_capi_utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/python/intern/bpy_capi_utils.c b/source/blender/python/intern/bpy_capi_utils.c
index 27eea80f1f6..8eb44e918d7 100644
--- a/source/blender/python/intern/bpy_capi_utils.c
+++ b/source/blender/python/intern/bpy_capi_utils.c
@@ -51,16 +51,17 @@ void BPy_SetContext(bContext *C)
char *BPy_enum_as_string(const EnumPropertyItem *item)
{
DynStr *dynstr = BLI_dynstr_new();
- const EnumPropertyItem *e;
- char *cstring;
- for (e = item; item->identifier; item++) {
+ /* We can't compare with the first element in the array
+ * since it may be a category (without an identifier). */
+ for (bool is_first = true; item->identifier; item++) {
if (item->identifier[0]) {
- BLI_dynstr_appendf(dynstr, (e == item) ? "'%s'" : ", '%s'", item->identifier);
+ BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
+ is_first = false;
}
}
- cstring = BLI_dynstr_get_cstring(dynstr);
+ char *cstring = BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
return cstring;
}