From 5e66564c00bbdf8acc67b63c4271d3d0b778ff0d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 2 Apr 2019 12:05:08 +0200 Subject: [PATCH] Ensure that configurationTypes doesn't crash if a None is in the list Fixes #5551 --- cura/Settings/GlobalStack.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 3940af7ecc..de2273380b 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -81,7 +81,15 @@ class GlobalStack(CuraContainerStack): # Requesting it from the metadata actually gets them as strings (as that's what you get from serializing). # But we do want them returned as a list of ints (so the rest of the code can directly compare) connection_types = self.getMetaDataEntry("connection_type", "").split(",") - return [int(connection_type) for connection_type in connection_types if connection_type != ""] + result = [] + for connection_type in connection_types: + if connection_type != "": + try: + result.append(int(connection_type)) + except ValueError: + # We got invalid data, probably a None. + pass + return result ## \sa configuredConnectionTypes def addConfiguredConnectionType(self, connection_type: int) -> None: