From b43048a871133182f1d7bd747f8fd445f4149012 Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Thu, 18 Feb 2016 20:24:17 +0100
Subject: [PATCH] filelist: Do not print error when a correct filelist file is
 specified

---
 src/filelist.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/filelist.c b/src/filelist.c
index 47b0534..7e9dcbe 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -523,6 +523,7 @@ gib_list *feh_read_filelist(char *filename)
 	FILE *fp;
 	gib_list *list = NULL;
 	char s[1024], s1[1024];
+	Imlib_Load_Error err = IMLIB_LOAD_ERROR_NONE;
 	Imlib_Image tmp_im;
 	struct stat st;
 	signed short tmp_magick_timeout;
@@ -535,12 +536,15 @@ gib_list *feh_read_filelist(char *filename)
 	 */
 	tmp_magick_timeout = opt.magick_timeout;
 	opt.magick_timeout = -1;
-	if (!stat(filename, &st) && S_ISREG(st.st_mode) &&
-			feh_load_image_char(&tmp_im, filename)) {
-		weprintf("Filelist file %s is an image, refusing to use it.\n"
-			"Did you mix up -f and -F?", filename);
-		opt.filelistfile = NULL;
-		return NULL;
+	if (!stat(filename, &st) && S_ISREG(st.st_mode)) {
+		tmp_im = imlib_load_image_with_error_return(filename, &err);
+		if (err == IMLIB_LOAD_ERROR_NONE) {
+			gib_imlib_free_image_and_decache(tmp_im);
+			weprintf("Filelist file %s is an image, refusing to use it.\n"
+				"Did you mix up -f and -F?", filename);
+			opt.filelistfile = NULL;
+			return NULL;
+		}
 	}
 	opt.magick_timeout = tmp_magick_timeout;
 
-- 
GitLab