From 2f6936c961ada60271d24202a44e5f89aff628b5 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 28 Mar 2017 17:45:15 +0200 Subject: [PATCH] Fix type checking in GlobalStack --- cura/Settings/GlobalStack.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 0b46c53da1..fb9719ba11 100644 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -178,9 +178,10 @@ class GlobalStack(ContainerStack): @override(ContainerStack) def replaceContainer(self, index: int, container: ContainerInterface, postpone_emit: bool = False) -> None: expected_type = _ContainerIndexes.IndexTypeMap[index] - if expected_type == "definition" and not isinstance(container, DefinitionContainer): - raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not a DefinitionContainer".format(index = index)) - if container != self._empty_instance_container and container.getMetaDataEntry("type") != expected_type: + if expected_type == "definition": + if not isinstance(container, DefinitionContainer): + raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not a DefinitionContainer".format(index = index)) + elif container != self._empty_instance_container and container.getMetaDataEntry("type") != expected_type: raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not of {type} type".format(index = index, type = expected_type)) super().replaceContainer(index, container, postpone_emit)