diff options
author | Ton Roosendaal <ton@blender.org> | 2007-03-26 17:02:43 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-03-26 17:02:43 +0400 |
commit | d1315a342d7db1653a7fc3cecb646ab785e08f6e (patch) | |
tree | c071b9dfc999c24a373a9454fa05fc8a242e5a3a /source | |
parent | 31673f0a8c5b98b3a837d5003ca1275080354bee (diff) |
Bugfix: function new_id() was allowed to be called with NULL.
Caused by Ken Hughes commit of 5 days ago
Note; dup_id() will go away, is not according to Blender spec.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index d8fab3cf696..4468ec684c0 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -811,7 +811,7 @@ int dup_id(ListBase *lb, ID *id, const char *tname) if( strlen(name) > 21 ) name[21]= 0; } - if(lb==0) lb= wich_libbase(G.main, GS(id->name)); + if(lb==NULL) lb= wich_libbase(G.main, GS(id->name)); /* phase 1: id already exists? */ idtest= lb->first; @@ -883,8 +883,11 @@ int new_id(ListBase *lb, ID *id, const char *tname) /* only for local blocks: external en indirect blocks already have a unique ID */ /* return 1: created a new name */ { - int result = dup_id( lb, id, tname ); - + int result; + + if(lb==NULL) lb= wich_libbase(G.main, GS(id->name)); + + result = dup_id( lb, id, tname ); if( result ) sort_alpha_id(lb, id); |