Correctly handle IndexError for defaultColors

CURA-4072

defaultColors is a list, so it's not KeyError but IndexError.
This commit is contained in:
Lipu Fei 2017-07-21 16:03:09 +02:00
parent d7f3553c90
commit 3aabbab11f

View file

@ -177,7 +177,7 @@ class ProcessSlicedLayersJob(Job):
position = int(extruder.getMetaDataEntry("position", default="0")) # Get the position
try:
default_color = ExtrudersModel.defaultColors[position]
except KeyError:
except IndexError:
default_color = "#e0e000"
color_code = extruder.material.getMetaDataEntry("color_code", default=default_color)
color = colorCodeToRGBA(color_code)