From 6e30d57a27a7d5ee35482831fa82d4f4dfb72aa5 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Tue, 3 May 2011 15:07:08 +0800 Subject: check for non-zero attribute before invoking del method --- nxt-python-fantom/nxt/fantomglue.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nxt-python-fantom/nxt/fantomglue.py b/nxt-python-fantom/nxt/fantomglue.py index 6281c95..178d7b0 100644 --- a/nxt-python-fantom/nxt/fantomglue.py +++ b/nxt-python-fantom/nxt/fantomglue.py @@ -53,7 +53,8 @@ class BluetoothSocket: return self._sock.read( numbytes ) def close(self): - del self._sock + if sef._sock is not None: + del self._sock class BluetoothError(IOError): pass @@ -107,4 +108,5 @@ class USBSocket: return self._sock.read( numbytes ) def close(self): - del self._sock + if sef._sock is not None: + del self._sock -- cgit v1.2.3