Skip to content

Commit

Permalink
Fix crash when loading collection listing inexistent files.
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Dec 13, 2012
1 parent cf90f24 commit 11b6ce5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/collect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 4 additions & 2 deletions src/filedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 11b6ce5

Please sign in to comment.