From a960dba87d4de71747d4923d18217bc6bab9bd38 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 16 Dec 2023 13:39:23 -0600 Subject: [PATCH] default to survival mode when GameMode is out of bounds --- azalea-core/src/game_type.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azalea-core/src/game_type.rs b/azalea-core/src/game_type.rs index 8a17ef498..118fdbb9f 100644 --- a/azalea-core/src/game_type.rs +++ b/azalea-core/src/game_type.rs @@ -94,7 +94,7 @@ impl GameMode { impl McBufReadable for GameMode { fn read_from(buf: &mut Cursor<&[u8]>) -> Result { let id = u8::read_from(buf)?; - GameMode::from_id(id).ok_or(BufReadError::UnexpectedEnumVariant { id: id as i32 }) + Ok(GameMode::from_id(id).unwrap_or_default()) } }