diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-04-16 18:08:00 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-04-16 18:08:00 +0200 |
commit | a22f14528deeee8d3ee2795f0eeef305785c964c (patch) | |
tree | 9ac369fd32c9103172d4c16b2307304f9352be05 /src/thumbnail.c | |
parent | cc6d820e1e9d2838b077c06f66ad6d020424ed14 (diff) |
Thumbnail generation: Handle HOME-less users (and some other edge cases)
Diffstat (limited to 'src/thumbnail.c')
-rw-r--r-- | src/thumbnail.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/thumbnail.c b/src/thumbnail.c index 040aade..08da0b2 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -566,6 +566,12 @@ int feh_thumbnail_get_thumbnail(Imlib_Image * image, feh_file * file, if (td.cache_thumbnails) { uri = feh_thumbnail_get_name_uri(file->filename); thumb_file = feh_thumbnail_get_name(uri); + + if (thumb_file == NULL) { + free(uri); + return feh_load_image(image, file); + } + status = feh_thumbnail_get_generated(image, file, thumb_file, orig_w, orig_h); @@ -699,6 +705,10 @@ int feh_thumbnail_generate(Imlib_Image * image, feh_file * file, snprintf(c_width, 8, "%d", w); snprintf(c_height, 8, "%d", h); prefix = feh_thumbnail_get_prefix(); + if (prefix == NULL) { + gib_imlib_free_image_and_decache(im_temp); + return 0; + } tmp_thumb_file = estrjoin("/", prefix, ".feh_thumbnail_XXXXXX", NULL); free(prefix); tmp_fd = mkstemp(tmp_thumb_file); @@ -716,10 +726,10 @@ int feh_thumbnail_generate(Imlib_Image * image, feh_file * file, gib_imlib_free_image_and_decache(im_temp); - return (1); + return 1; } - return (0); + return 0; } int feh_thumbnail_get_generated(Imlib_Image * image, feh_file * file, |