From ac4eb5302943a4c086445fa5efd41ff66851505f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Sun, 13 Nov 2011 15:53:09 +0100 Subject: Fixed issue #28 (again) --- Makefile | 2 +- image.c | 14 ++++++++------ thumbs.c | 10 ++++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index ce6680b..33870c0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20111111 +VERSION = git-20111113 CC = gcc CFLAGS = -ansi -Wall -pedantic -O2 diff --git a/image.c b/image.c index c6b6f31..65df889 100644 --- a/image.c +++ b/image.c @@ -311,16 +311,18 @@ bool img_load(img_t *img, const fileinfo_t *file) { imlib_image_set_changes_on_disk(); imlib_context_set_anti_alias(img->aa); - if ((fmt = imlib_image_format()) != NULL) { + if ((fmt = imlib_image_format()) == NULL) { + warn("could not open image: %s", file->name); + return false; + } #if EXIF_SUPPORT - if (STREQ(fmt, "jpeg")) - exif_auto_orientate(file); + if (STREQ(fmt, "jpeg")) + exif_auto_orientate(file); #endif #if GIF_SUPPORT - if (STREQ(fmt, "gif")) - img_load_gif(img, file); + if (STREQ(fmt, "gif")) + img_load_gif(img, file); #endif - } img->w = imlib_image_get_width(); img->h = imlib_image_get_height(); diff --git a/thumbs.c b/thumbs.c index 2540d25..451947e 100644 --- a/thumbs.c +++ b/thumbs.c @@ -253,10 +253,12 @@ bool tns_load(tns_t *tns, int n, const fileinfo_t *file, imlib_context_set_image(im); imlib_context_set_anti_alias(1); - fmt = imlib_image_format(); - /* avoid unused-but-set-variable warning */ - (void) fmt; - + if ((fmt = imlib_image_format()) == NULL) { + if (!silent) + warn("could not open image: %s", file->name); + imlib_free_image_and_decache(); + return false; + } #if EXIF_SUPPORT if (!cache_hit && STREQ(fmt, "jpeg")) exif_auto_orientate(file); -- cgit v1.2.3