Merge remote-tracking branch 'origin/merge-requests/5'
authorKlaus Ethgen <Klaus@Ethgen.de>
Sun, 20 Jul 2014 12:54:56 +0000 (13:54 +0100)
committerKlaus Ethgen <Klaus@Ethgen.de>
Sun, 20 Jul 2014 12:54:56 +0000 (13:54 +0100)
* origin/merge-requests/5:
  Fix crash when loading collection listing inexistent files.

This is now a combination of Leons patch 900e65e and merge request of
Laurent. Hopefully that is now a bit more stable.

src/collect.c
src/filedata.c

index c69155d..e3c0157 100644 (file)
@@ -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));
index 15e2017..9c2ac8c 100644 (file)
@@ -1151,7 +1151,10 @@ FileData *file_data_new_group(const gchar *path_utf8)
 
        fd = g_hash_table_lookup(file_data_pool, path_utf8);
        if (!fd) fd = file_data_new(path_utf8, &st, TRUE);
-       file_data_ref(fd);
+       if (fd)
+               {
+               file_data_ref(fd);
+               }
 
        filelist_free(files);
        g_free(dir);