From da85ce0baf94c49b3eefc1e557d3f3a32e4c55fb Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 25 Oct 2020 18:10:40 -0600 Subject: [PATCH] handle case where no ships in list --- src/packet/login.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packet/login.rs b/src/packet/login.rs index 233f05f..7a506fd 100644 --- a/src/packet/login.rs +++ b/src/packet/login.rs @@ -502,7 +502,7 @@ impl ShipList { pub fn new(ships: Vec) -> ShipList { ShipList { baseship: ShipListEntry { - menu: ships[0].menu, + menu: ships.get(0).map(|s| s.menu).unwrap_or(0), item: 0, flags: 0, name: utf8_to_utf16_array!("Ship", 0x11),