1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

default to survival mode when GameMode is out of bounds

This commit is contained in:
mat 2023-12-16 13:39:23 -06:00
parent 1119cd7fa0
commit 70cc93719f

View file

@ -94,7 +94,7 @@ impl GameMode {
impl McBufReadable for GameMode {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
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())
}
}