From 49849e79042f2d2065e3140840084b2d7141a1fb Mon Sep 17 00:00:00 2001 From: Andy Newjack Date: Fri, 1 May 2020 18:44:59 -0300 Subject: [PATCH] assume get neighbours was successful --- src/ship/ship.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ship/ship.rs b/src/ship/ship.rs index cc21d87..d646ac5 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -331,12 +331,13 @@ impl ServerState for ShipServerState { } fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendShipPacket)> { + // TODO: don't unwrap! let client = self.client_location.get_local_client(id).unwrap(); let neighbors = self.client_location.get_client_neighbors(id).unwrap(); let pkt = match self.client_location.get_area(id).unwrap() { RoomLobby::Room(room) => { - if let 0 = neighbors.len() { + if neighbors.len() == 0 { self.rooms[room.0] = None; } let leader = self.client_location.get_room_leader(room).unwrap();