From cd8bca7e3b3c0e31c72220385eaaa5282b32b21c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 21 Jun 2014 17:37:54 +0200 Subject: [PATCH] Catch QColors passed to ColorDict --- qutebrowser/config/style.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qutebrowser/config/style.py b/qutebrowser/config/style.py index 62b5443af..ffe4c0013 100644 --- a/qutebrowser/config/style.py +++ b/qutebrowser/config/style.py @@ -26,6 +26,8 @@ Module attributes: from functools import partial +from PyQt5.QtGui import QColor + import qutebrowser.config.config as config from qutebrowser.utils.log import style as logger @@ -107,6 +109,11 @@ class ColorDict(dict): except KeyError as e: logger.warning(e) return '' + if isinstance(val, QColor): + # This could happen when accidentaly declarding something as + # QtColor instead of Color in the config, and it'd go unnoticed as + # the CSS is invalid then. + raise TypeError("QColor passed to ColorDict!") if 'fg' in key.split('.'): return 'color: {};'.format(val) elif 'bg' in key.split('.'):