From e839fab860a6ce415754af626c4afe00d8e9741a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 8 Jul 2017 11:58:43 +1000 Subject: [PATCH] magic: Fixed infinite loop when wal is given a really simple image. --- pywal/magic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pywal/magic.py b/pywal/magic.py index 406a513..d4dd213 100644 --- a/pywal/magic.py +++ b/pywal/magic.py @@ -41,6 +41,11 @@ def gen_colors(img): "color palette, trying a larger palette size", COLOR_COUNT + index) + if index > 20: + print("colors: Imagemagick couldn't generate a suitable scheme", + "for the image. Exiting...") + quit(1) + # Remove the first element, which isn't a color. del raw_colors[0]