Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/graphics
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2010-10-17 10:04:32 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-11-30 11:48:31 (GMT)
commit3b0e761f4a27624b7f6868d4cb2432b4ea37376d (patch)
tree9089f3e44e0553750a3c0579931761b0dfbdb3e9 /src/sugar/graphics
parent18e39672ce521eb217f466964c63d2cb14bcf1d8 (diff)
XoColor: don't choke if passed the wrong type (SL#1408)
Color data is stored in the Journal as a JSON dump, so we can get back arbitrary types. XoColor already checks the color string for validity and handles invalid strings gracefully, so it makes sense to enhance this to invalid types as well. Acked-by: Simon Schampijer <simon@schampijer.de>
Diffstat (limited to 'src/sugar/graphics')
-rw-r--r--src/sugar/graphics/xocolor.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sugar/graphics/xocolor.py b/src/sugar/graphics/xocolor.py
index df60917..395e345 100644
--- a/src/sugar/graphics/xocolor.py
+++ b/src/sugar/graphics/xocolor.py
@@ -209,6 +209,10 @@ colors = [
def _parse_string(color_string):
+ if not isinstance(color_string, (str, unicode)):
+ logging.error('Invalid color string: %r', color_string)
+ return None
+
if color_string == 'white':
return ['#ffffff', '#414141']
elif color_string == 'insensitive':