diff --git a/server/src/events/player.rs b/server/src/events/player.rs index 439fc613d1..3e5aac94d1 100644 --- a/server/src/events/player.rs +++ b/server/src/events/player.rs @@ -80,7 +80,13 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity) { pub fn handle_client_disconnect(server: &mut Server, entity: EcsEntity) -> Event { if let Some(client) = server.state().read_storage::().get(entity) { trace!("Closing participant of client"); - let participant = client.participant.lock().unwrap().take().unwrap(); + let participant = match client.participant.try_lock() { + Ok(mut p) => p.take().unwrap(), + Err(e) => { + error!(?e, "coudln't lock participant for removal"); + panic!("coudlnt lock participant, not good!"); + }, + }; if let Err(e) = block_on(participant.disconnect()) { debug!( ?e,