From 533ce78b9049f1f0a8c0e15d3a3366e6b5c211ab Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 27 Mar 2015 10:08:03 +0100 Subject: [PATCH] Fix crash if we call stop on dynamips on non started process Fix #111 --- gns3server/modules/dynamips/dynamips_hypervisor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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