From: Laurent Monin Date: Mon, 26 Nov 2012 08:29:17 +0000 (+0100) Subject: Fix crash when loading collection listing inexistent files. X-Git-Tag: v1.2~2^2 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=11b6ce5218bca998f5a9a6b24fc5ce1beb87412d Fix crash when loading collection listing inexistent files. --- diff --git a/src/collect.c b/src/collect.c index c69155dc..e3c01571 100644 --- a/src/collect.c +++ b/src/collect.c @@ -595,6 +595,10 @@ gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, struct stat st; gboolean valid; + if (!fd) return FALSE; + + g_assert(fd->magick == FD_MAGICK); + if (must_exist) { valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode)); diff --git a/src/filedata.c b/src/filedata.c index e0d70f00..9478cf86 100644 --- a/src/filedata.c +++ b/src/filedata.c @@ -1150,8 +1150,10 @@ FileData *file_data_new_group(const gchar *path_utf8) filelist_read_real(dir, &files, NULL, TRUE); fd = g_hash_table_lookup(file_data_pool, path_utf8); - g_assert(fd); - file_data_ref(fd); + if (fd) + { + file_data_ref(fd); + } filelist_free(files); g_free(dir);