mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Ensure that configurationTypes doesn't crash if a None is in the list
Fixes #5551
This commit is contained in:
parent
8a62cd7610
commit
5e66564c00
1 changed files with 9 additions and 1 deletions
|
@ -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).
|
# 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)
|
# 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(",")
|
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
|
## \sa configuredConnectionTypes
|
||||||
def addConfiguredConnectionType(self, connection_type: int) -> None:
|
def addConfiguredConnectionType(self, connection_type: int) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue