mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Prevent a zeroDivision error from crashing the usb printing
This fixes #5592
This commit is contained in:
parent
0bad57259c
commit
cbfe10a748
1 changed files with 9 additions and 2 deletions
|
@ -371,10 +371,17 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
|
|
||||||
self._sendCommand("N%d%s*%d" % (self._gcode_position, line, checksum))
|
self._sendCommand("N%d%s*%d" % (self._gcode_position, line, checksum))
|
||||||
|
|
||||||
progress = (self._gcode_position / len(self._gcode))
|
print_job = self._printers[0].activePrintJob
|
||||||
|
try:
|
||||||
|
progress = self._gcode_position / len(self._gcode)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
# There is nothing to send!
|
||||||
|
if print_job is not None:
|
||||||
|
print_job.updateState("error")
|
||||||
|
return
|
||||||
|
|
||||||
elapsed_time = int(time() - self._print_start_time)
|
elapsed_time = int(time() - self._print_start_time)
|
||||||
print_job = self._printers[0].activePrintJob
|
|
||||||
if print_job is None:
|
if print_job is None:
|
||||||
controller = GenericOutputController(self)
|
controller = GenericOutputController(self)
|
||||||
controller.setCanUpdateFirmware(True)
|
controller.setCanUpdateFirmware(True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue