summaryrefslogtreecommitdiff
path: root/magic/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'magic/__init__.py')
-rw-r--r--magic/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/magic/__init__.py b/magic/__init__.py
index 17456c1..363e88f 100644
--- a/magic/__init__.py
+++ b/magic/__init__.py
@@ -150,7 +150,7 @@ class Magic:
# incorrect fix for a threading problem, however I'm leaving
# it in because it's harmless and I'm slightly afraid to
# remove it.
- if self.cookie and magic_close:
+ if hasattr(self, 'cookie') and self.cookie and magic_close:
magic_close(self.cookie)
self.cookie = None