mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
When trying to convert None to RGBA, log it and return a usable default
contributes to #1869
This commit is contained in:
parent
da39ab8093
commit
e6f61f3bbc
1 changed files with 3 additions and 0 deletions
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue