diff --git a/gns3server/modules/dynamips/dynamips_hypervisor.py b/gns3server/modules/dynamips/dynamips_hypervisor.py index 2b0401d7..60a24b19 100644 --- a/gns3server/modules/dynamips/dynamips_hypervisor.py +++ b/gns3server/modules/dynamips/dynamips_hypervisor.py @@ -136,8 +136,9 @@ class DynamipsHypervisor: except DynamipsError: pass try: - yield from self._writer.drain() - self._writer.close() + if self._writer is not None: + yield from self._writer.drain() + self._writer.close() except OSError as e: log.debug("Stopping hypervisor {}:{} {}".format(self._host, self._port, e)) self._reader = self._writer = None