Fix T45405: Crash on opening a file (in filebrowser code)
authorJulian Eisel <eiseljulian@gmail.com>
Fri, 10 Jul 2015 20:04:06 +0000 (22:04 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Fri, 10 Jul 2015 20:09:14 +0000 (22:09 +0200)
Quoting Bastien from IRC: "Filebrowser is a nest of bad surprises" -- indeed :S

source/blender/editors/space_file/file_draw.c

index 6106b723e997bab4a35bf3db7616f5e0d3f3c2b7..3c09800c310aaca7cb2571af9f891f843b334f54 100644 (file)
@@ -157,7 +157,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 
        /* Text input fields for directory and file. */
        if (available_w > 0) {
-               const struct direntry *file = filelist_file(sfile->files, params->active_file);
+               const struct direntry *file = sfile->files ? filelist_file(sfile->files, params->active_file) : NULL;
                int overwrite_alert = file_draw_check_exists(sfile);
                const bool is_active_dir = file && file->path && BLI_is_dir(file->path);
                char *dir_path = (is_active_dir && params->active_file > 0) ? file->path : params->dir;