Server: Check if self.clients list is not empty when trying to pop element from it

This commit is contained in:
Arthur Golubtsov
2019-10-16 15:28:53 +03:00
parent 9cbd7e1b15
commit 49fb6c1153

View File

@@ -310,8 +310,8 @@ class Client(messaging.ConnectionManager):
def remove(self):
if self.connected:
self.close()
self.clients.pop(self.addr[0])
if self.clients:
self.clients.pop(self.addr[0])
logging.info("Client {} successfully removed!".format(self.copter_id))
@requires_connect