summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-05-03 15:07:08 +0800
committerTat-Chee Wan (USM)2011-05-03 15:07:08 +0800
commit6e30d57a27a7d5ee35482831fa82d4f4dfb72aa5 (patch)
treea4c2cb8bfe1891ebe9090ec690e735fddb6c82ad
parent1e3b294f345511538c64cce8f9f3e0ba3c82d1e3 (diff)
check for non-zero attribute before invoking del method
-rw-r--r--nxt-python-fantom/nxt/fantomglue.py6
1 files 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