serial: do not try to close non existing serial connection

The SerialSimLink only has an _sl member if serial initalization was
successfull. If we close a serial connection, check if we even have the
_sl member. Otherwise move on silently.

Change-Id: Ic3f3f5e50d780f424da7d0be5733d7167bb7159c
This commit is contained in:
Philipp Maier committed 2021-02-25 16:27:08 +01:00
1 parent 92bdd5e901
commit 289fd28091
1 file changed
+2 -1
+2 -1
View File
@@ -52,7 +52,8 @@ class SerialSimLink(LinkBase):
self._atr = None
def __del__(self):
self._sl.close()
if (hasattr(self, "_sl")):
self._sl.close()
def wait_for_card(self, timeout=None, newcardonly=False):
# Direct try