Skip to content

Commit

Permalink
"Add null check to prevent crash in GradualFlowPlugin"
Browse files Browse the repository at this point in the history
A null check condition has been added to the 'usePlugin' method in GradualFlowPlugin.py to ensure 'activeMachine' is not None before accessing its 'extruderList'. Previously, if 'activeMachine' was null, it would lead to a crash while trying to access its properties. Therefore, this change improves the robustness of the code.

Fixes CURA-11144
  • Loading branch information
jellespijker committed Oct 11, 2023
1 parent 9deac72 commit c311dce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CuraEngineGradualFlow/GradualFlowPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _on_container_load_complete(self, container_id) -> None:

def usePlugin(self):
machine_manager = CuraApplication.getInstance().getMachineManager()
return any([extr.getProperty(f"{constants.settings_prefix}_gradual_flow_enabled", "value") for extr in machine_manager.activeMachine.extruderList if extr.hasProperty(f"{constants.settings_prefix}_gradual_flow_enabled", "value")])
return any([extr.getProperty(f"{constants.settings_prefix}_gradual_flow_enabled", "value") for extr in machine_manager.activeMachine.extruderList if machine_manager.activeMachine is not None and extr.hasProperty(f"{constants.settings_prefix}_gradual_flow_enabled", "value")])

def getPort(self):
return super().getPort() if not self.isDebug() else int(os.environ["CURAENGINE_GCODE_PATHS_MODIFY_PORT"])
Expand Down

1 comment on commit c311dce

@MikeOxawopper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an update or do i need to do something with this?

Please sign in to comment.