From 9bfbdd8118611059fe46ac4bb92d0a5b9a05741d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 Aug 2013 08:20:37 +0000 Subject: remove assert in check_for_dupid() function for rare but valid renaming situation. --- source/blender/blenkernel/intern/library.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/library.c') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 7eb4a3a2a8d..c23fa097d3e 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1264,17 +1264,13 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name) static bool check_for_dupid(ListBase *lb, ID *id, char *name) { ID *idtest; - int nr = 0, nrtest, a, left_len; + int nr = 0, a, left_len; #define MAX_IN_USE 64 bool in_use[MAX_IN_USE]; /* to speed up finding unused numbers within [1 .. MAX_IN_USE - 1] */ char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8]; - /* make sure input name is terminated properly */ - /* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3] = 0; */ - /* removed since this is only ever called from one place - campbell */ - while (true) { /* phase 1: id already exists? */ @@ -1301,6 +1297,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name) } for (idtest = lb->first; idtest; idtest = idtest->next) { + int nrtest; if ( (id != idtest) && (idtest->lib == NULL) && (*name == *(idtest->name + 2)) && @@ -1315,8 +1312,8 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name) nr = nrtest + 1; /* track largest unused */ } } - /* At this point, nr will be at least 1. */ - BLI_assert(nr >= 1); + /* At this point, 'nr' will typically be at least 1. (but not always) */ + // BLI_assert(nr >= 1); /* decide which value of nr to use */ for (a = 0; a < MAX_IN_USE; a++) { -- cgit v1.2.3