Skip to content

Commit

Permalink
dont send to an unconnected lobby server connection, due to possible …
Browse files Browse the repository at this point in the history
…crash
  • Loading branch information
Martin Müllenhaupt authored and Wesmania committed May 31, 2018
1 parent 9b447be commit 25bd699
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ def writeToServer(self, action, *args, **kw):
out.writeUInt32(2 * len(action) + 4)
out.writeQString(action)

self.socket.write(block)
# it looks like there's a crash in Qt when sending to an unconnected socket
if self.socket.state() == QtNetwork.QAbstractSocket.ConnectedState:
self.socket.write(block)

def send(self, message):
data = json.dumps(message)
Expand Down

0 comments on commit 25bd699

Please sign in to comment.