diff options
Diffstat (limited to 'azalea-chat/src')
| -rwxr-xr-x | azalea-chat/src/component.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index 94a5125f..bd9b7269 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -412,9 +412,13 @@ impl simdnbt::FromNbtTag for FormattedText { #[cfg(feature = "azalea-buf")] impl McBufReadable for FormattedText { fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result<Self, BufReadError> { - let nbt = simdnbt::borrow::NbtTag::read(buf)?; - FormattedText::from_nbt_tag(&nbt) - .ok_or(BufReadError::Custom("couldn't read nbt".to_owned())) + let nbt = simdnbt::borrow::NbtTag::read_optional(buf)?; + if let Some(nbt) = nbt { + FormattedText::from_nbt_tag(&nbt) + .ok_or(BufReadError::Custom("couldn't read nbt".to_owned())) + } else { + Ok(FormattedText::default()) + } } } |
