Cancel close only if literal False|None _device

This commit is contained in:
belono 2023-10-25 22:45:46 +02:00
parent 363d322265
commit 5daf3efa30

View File

@ -138,7 +138,7 @@ class Win32Raw(Escpos):
def close(self) -> None:
"""Close connection to default printer."""
if not self._device:
if self._device is False or self._device is None: # Literal False | None
return
logging.info("Closing Win32Raw connection to printer %s", self.printer_name)
win32print.EndPagePrinter(self._device)