diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 750af72..e329a84 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -267,7 +267,9 @@ impl ServerState for ShipServerState { } }, RecvShipPacket::RoomPasswordReq(room_password_req) => { - if room_password_req.password == self.rooms[room_password_req.item as usize].as_ref().unwrap().password { + if room_password_req.password == self.rooms[room_password_req.item as usize].as_ref() + .ok_or(ShipError::InvalidRoom(room_password_req.item))? + .password { let menuselect = MenuSelect { menu: room_password_req.menu, item: room_password_req.item,