mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 18:49:01 +08:00
Catch FileNotFoundError when updating custom firmware
In case there is a bug there, we won't crash the thread.
This commit is contained in:
parent
0655ef0bc5
commit
877d061a1b
@ -127,9 +127,11 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||
if self._connection_state != ConnectionState.closed:
|
||||
self.close()
|
||||
|
||||
try:
|
||||
hex_file = intelHex.readHex(self._firmware_location)
|
||||
if len(hex_file) == 0:
|
||||
Logger.log("e", "Unable to read provided hex file. Could not update firmware")
|
||||
assert len(hex_file) > 0
|
||||
except (FileNotFoundError, AssertionError):
|
||||
Logger.log("e", "Unable to read provided hex file. Could not update firmware.")
|
||||
self.setFirmwareUpdateState(FirmwareUpdateState.firmware_not_found_error)
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user