From 8d895e0b5e49b86b6b7b7dd1629a91a915a9e76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sun, 15 Oct 2023 06:33:30 +0300 Subject: [PATCH] Skip zero byte images when generating thumbnails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- waypaper/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/waypaper/app.py b/waypaper/app.py index 8e9c503..a6a6e1c 100644 --- a/waypaper/app.py +++ b/waypaper/app.py @@ -273,6 +273,10 @@ class App(Gtk.Window): self.image_names = [] for image_path in self.image_paths: + if os.path.getsize(image_path) == 0: + # Skip zero byte files inside the image_path + self.image_paths.remove(image_path) + continue # If this image is not cached yet, resize and cache it: cached_image_path = self.cachePath/os.path.basename(image_path) if not cached_image_path.exists():