Defensive programming for isometric snapshot.

This commit is contained in:
Remco Burema 2023-11-01 17:14:29 +01:00
parent 692b27ce3c
commit d2db9a2555

View file

@ -113,16 +113,18 @@ class MakerbotWriter(MeshWriter):
return
try:
snapshot = Snapshot.isometricSnapshot(width, height)
thumbnail_buffer = QBuffer()
thumbnail_buffer.open(QBuffer.OpenModeFlag.WriteOnly)
snapshot.save(thumbnail_buffer, "PNG")
return thumbnail_buffer
except:
Logger.logException("w", "Failed to create snapshot image")
return
thumbnail_buffer = QBuffer()
thumbnail_buffer.open(QBuffer.OpenModeFlag.WriteOnly)
snapshot.save(thumbnail_buffer, "PNG")
return thumbnail_buffer
return None
def write(self, stream: BufferedIOBase, nodes: List[SceneNode], mode=MeshWriter.OutputMode.BinaryMode) -> bool:
if mode != MeshWriter.OutputMode.BinaryMode: