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>
This commit is contained in:
		
							parent
							
								
									18e39672ce
								
							
						
					
					
						commit
						3b0e761f4a
					
				| @ -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': | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Sascha Silbe
						Sascha Silbe