Skip to content

Commit

Permalink
check if socket is set before calling close
Browse files Browse the repository at this point in the history
  • Loading branch information
njnes committed Aug 7, 2024
1 parent a4cabfb commit 47e4ea8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pymonetdb/mapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ def disconnect(self):
""" disconnect from the monetdb server """
logger.info("Closing connection")
self.state = STATE_INIT
self.socket.close()
if self.socket:
self.socket.close()
self.socket = None

def _sabotage(self):
""" Kill the connection in a way that the server is sure to recognize as an error"""
Expand Down

0 comments on commit 47e4ea8

Please sign in to comment.