From 1ff36760d36a83407794f22cc419fac99182f6d5 Mon Sep 17 00:00:00 2001 From: Martin Terneborg Date: Tue, 7 Apr 2020 21:23:28 +0200 Subject: [PATCH] Fix error with iterative option in empty directory --- pywal/image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pywal/image.py b/pywal/image.py index 6ef74fc..08b8d11 100644 --- a/pywal/image.py +++ b/pywal/image.py @@ -79,7 +79,11 @@ def get_next_image(img_dir, recursive): image = images[next_index] except IndexError: - image = images[0] + if images: + image = images[0] + else: + logging.error("No images found in directory.") + sys.exit(1) return os.path.join(img_dir if not recursive else "", image)