From ef9c95935ce9bd9152a6dde502fcf0b7832ec242 Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Date: Sat, 30 Apr 2022 22:28:24 +0200 Subject: [PATCH 1/2] Fix for crash when ~/.cache/wal was empty --- pywal/wallpaper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index 6a50627..1a85fc1 100644 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -202,6 +202,10 @@ def get(cache_dir=CACHE_DIR): current_wall = os.path.join(cache_dir, "wal") if os.path.isfile(current_wall): - return util.read_file(current_wall)[0] + # make sure the file has some content in it, + contents = util.read_file(current_wall) + + if len(contents) > 0: + return contents [0] return "None" From fdf4b7dfc6d4261097dd51f62e31ebd7402d8a12 Mon Sep 17 00:00:00 2001 From: eylles Date: Wed, 11 May 2022 19:00:10 -0600 Subject: [PATCH 2/2] fix whitespaces --- pywal/wallpaper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index 1a85fc1..f948ba5 100644 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -204,8 +204,8 @@ def get(cache_dir=CACHE_DIR): if os.path.isfile(current_wall): # make sure the file has some content in it, contents = util.read_file(current_wall) - + if len(contents) > 0: - return contents [0] + return contents[0] return "None"