From 36ee49d28e5b144bed516a60bbdd4d33d8b1fcd4 Mon Sep 17 00:00:00 2001 From: Andy Newjack Date: Wed, 29 Apr 2020 00:45:48 -0300 Subject: [PATCH] remove unwrap --- src/ship/ship.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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,