From 062611a92acf0ebc02e4c8c1a6e7e4ccbbbb99a2 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 28 Sep 2016 15:56:10 +0200 Subject: [PATCH] Handle the startup situation where there is no global stack. Fixed a bug where the wrong stack was used instead of the first extruder. Contributes to CURA-2477 Profile menu should only contain valid options for all materials --- cura/Settings/ProfilesModel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index e7b1743556..07a498a895 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -18,6 +18,9 @@ class ProfilesModel(InstanceContainersModel): # See UM.Settings.Models.InstanceContainersModel._fetchInstanceContainers(). def _fetchInstanceContainers(self): global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack is None: + return [] + global_machine_definition = global_container_stack.getBottom() extruder_stacks = ExtruderManager.getInstance().getActiveExtruderStacks() @@ -26,7 +29,7 @@ class ProfilesModel(InstanceContainersModel): # Determine the common set of quality types which can be # applied to all of the materials for this machine. - quality_type_dict = self.__fetchQualityTypeDictForStack(global_container_stack, global_machine_definition) + quality_type_dict = self.__fetchQualityTypeDictForStack(extruder_stacks[0], global_machine_definition) common_quality_types = set(quality_type_dict.keys()) for stack in extruder_stacks[1:]: next_quality_type_dict = self.__fetchQualityTypeDictForStack(stack, global_machine_definition)