diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-24 18:45:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-24 18:45:49 +0400 |
commit | fd45310dfe30952081ef51f80e62543664ca84a5 (patch) | |
tree | 1c9babdc970a69ce1ebc569904ddd7f6c893295f /source/blender/editors/space_file/filelist.c | |
parent | 8fdebf24f4fe405c77f13a72c45cf0f8e6bc1f3f (diff) |
fix crash [#27158] Appending crash with preview.
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index f0ffe34476f..f815c7b4ac5 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1007,7 +1007,7 @@ void filelist_from_library(struct FileList* filelist) { LinkNode *l, *names, *previews; struct ImBuf* ima; - int ok, i, nnames, idcode; + int ok, i, nprevs, nnames, idcode; char filename[FILE_MAXDIR+FILE_MAXFILE]; char dir[FILE_MAX], group[GROUP_MAX]; @@ -1031,17 +1031,18 @@ void filelist_from_library(struct FileList* filelist) idcode= groupname_to_code(group); - // memory for strings is passed into filelist[i].relname - // and free'd in freefilelist - previews = NULL; + /* memory for strings is passed into filelist[i].relname + * and free'd in freefilelist */ if (idcode) { - previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode); + previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode, &nprevs); names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames); /* ugh, no rewind, need to reopen */ BLO_blendhandle_close(filelist->libfiledata); filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL); } else { + previews= NULL; + nprevs= 0; names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata); nnames= BLI_linklist_length(names); } @@ -1064,7 +1065,10 @@ void filelist_from_library(struct FileList* filelist) } } - if(previews) { + if(previews && (nnames != nprevs)) { + printf("filelist_from_library: error, found %d items, %d previews\n", nnames, nprevs); + } + else if(previews) { for (i=0, l= previews; i<nnames; i++, l= l->next) { PreviewImage *img= l->link; |