summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-04-16 18:08:00 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-04-16 18:08:00 +0200
commita22f14528deeee8d3ee2795f0eeef305785c964c (patch)
tree9ac369fd32c9103172d4c16b2307304f9352be05
parentcc6d820e1e9d2838b077c06f66ad6d020424ed14 (diff)
Thumbnail generation: Handle HOME-less users (and some other edge cases)
-rw-r--r--src/thumbnail.c14
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,