Fix error with iterative option in empty directory

This commit is contained in:
Martin Terneborg 2020-04-07 21:23:28 +02:00
parent 1f134ac9af
commit 1ff36760d3
No known key found for this signature in database
GPG Key ID: 6AC44E4AB0A5FD0B

View File

@ -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)