From 81ea9556ebb01606788e5ae6eb637aea208102bc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 4 May 2017 17:56:38 +0200 Subject: [PATCH] Fix showing layer view if there is no material The layer view would request the colour of the material. If there is no material, that would give an error. Contributes to issue CURA-3497. --- plugins/CuraEngineBackend/ProcessSlicedLayersJob.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 0d706f59b8..f7be2edc04 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -179,9 +179,10 @@ class ProcessSlicedLayersJob(Job): # Single extruder via global stack. material_color_map = numpy.zeros((1, 4), dtype=numpy.float32) material = global_container_stack.findContainer({"type": "material"}) - color_code = material.getMetaDataEntry("color_code") - if color_code is None: # not all stacks have a material color - color_code = "#e0e000" + color_code = "#e0e000" + if material: + if material.getMetaDataEntry("color_code") is not None: + color_code = material.getMetaDataEntry("color_code") color = colorCodeToRGBA(color_code) material_color_map[0, :] = color