From ef4ac2b592a62b4c160b764acdffe5fa1d9a4b9b Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 8 Dec 2004 18:36:48 +0000 Subject: Narrowed code for restoring UI after undo. It seems still an error in oops code, having pointers to ID structs that are invalid. This solves at least it crashing... oops needs to be refreshed once :) (occurred on testing complex files, with conversion from nurbs=>mesh) --- source/blender/blenloader/intern/readfile.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/blender/blenloader/intern') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 140a48acef2..d2551bf484d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2700,13 +2700,16 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user) if(id) { lb= wich_libbase(mainp, GS(id->name)); - idn= lb->first; - while(idn) { - if( strcmp(idn->name, id->name)==0) { - if(user && idn->us==0) idn->us++; - break; + + if(lb) { // there's still risk of checking corrupt mem (freed Ids in oops) + idn= lb->first; + while(idn) { + if( strcmp(idn->name, id->name)==0) { + if(user && idn->us==0) idn->us++; + break; + } + idn= idn->next; } - idn= idn->next; } } return idn; -- cgit v1.2.3