diff options
author | Kostas Karmas <konskarm@gmail.com> | 2020-06-25 15:52:07 +0300 |
---|---|---|
committer | Kostas Karmas <konskarm@gmail.com> | 2020-06-25 15:52:07 +0300 |
commit | 572ded8c952a094bdfafb027546ebd2e9b1bb6aa (patch) | |
tree | 1f56889b8edeecffad60194f17b8929e60ab2561 /plugins/3MFReader | |
parent | 79cc6ec897626f9601bc8af0060cf53872d84026 (diff) |
Fix crash while reading 3mf if extruder list is empty
CURA-7527
Diffstat (limited to 'plugins/3MFReader')
-rwxr-xr-x | plugins/3MFReader/ThreeMFWorkspaceReader.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index eaac225e00..5522714679 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -819,7 +819,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader): extruder_stack = None intent_category = None # type: Optional[str] if position is not None: - extruder_stack = global_stack.extruderList[int(position)] + try: + extruder_stack = global_stack.extruderList[int(position)] + except IndexError: + pass intent_category = quality_changes_intent_category_per_extruder[position] container = self._createNewQualityChanges(quality_changes_quality_type, intent_category, quality_changes_name, global_stack, extruder_stack) container_info.container = container @@ -849,7 +852,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # it might not have its extruders set properly. if len(global_stack.extruderList) == 0: ExtruderManager.getInstance().fixSingleExtrusionMachineExtruderDefinition(global_stack) - extruder_stack = global_stack.extruderList[0] + try: + extruder_stack = global_stack.extruderList[0] + except IndexError: + extruder_stack = None intent_category = quality_changes_intent_category_per_extruder["0"] container = self._createNewQualityChanges(quality_changes_quality_type, intent_category, quality_changes_name, global_stack, extruder_stack) @@ -878,7 +884,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader): continue if container_info.container is None: - extruder_stack = global_stack.extruderList[int(position)] + try: + extruder_stack = global_stack.extruderList[int(position)] + except IndexError: + extruder_stack = None intent_category = quality_changes_intent_category_per_extruder[position] container = self._createNewQualityChanges(quality_changes_quality_type, intent_category, quality_changes_name, global_stack, extruder_stack) container_info.container = container |