When trying to convert None to RGBA, log it and return a usable default

contributes to #1869
This commit is contained in:
Jaime van Kessel 2017-05-24 11:38:38 +02:00
parent da39ab8093
commit e6f61f3bbc

View file

@ -31,6 +31,9 @@ catalog = i18nCatalog("cura")
# #
# \param color_code html color code, i.e. "#FF0000" -> red # \param color_code html color code, i.e. "#FF0000" -> red
def colorCodeToRGBA(color_code): def colorCodeToRGBA(color_code):
if color_code is None:
Logger.log("w", "Unable to convert color code, returning default")
return [0, 0, 0, 1]
return [ return [
int(color_code[1:3], 16) / 255, int(color_code[1:3], 16) / 255,
int(color_code[3:5], 16) / 255, int(color_code[3:5], 16) / 255,