diff options
| author | mat <github@matdoes.dev> | 2022-10-10 01:04:09 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-10-10 01:04:09 -0500 |
| commit | a348f67b9646cf51bedf413bf79271391bdb23b2 (patch) | |
| tree | 612ef1b39e9ddfce016f5d734a6a326d6c3baf29 | |
| parent | 221b33197e2a084317e23c0d41fa6d4a6aab2e7b (diff) | |
| download | azalea-drasl-a348f67b9646cf51bedf413bf79271391bdb23b2.tar.xz | |
fix panic in azalea-chat
| -rwxr-xr-x | azalea-chat/src/text_component.rs | 4 | ||||
| -rw-r--r-- | azalea-client/src/client.rs | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs index a061924f..0e6c67e2 100755 --- a/azalea-chat/src/text_component.rs +++ b/azalea-chat/src/text_component.rs @@ -52,6 +52,10 @@ pub fn legacy_color_code_to_text_component(legacy_color_code: &str) -> TextCompo i += 1; } + if components.is_empty() { + return TextComponent::new("".to_string()); + } + // create the final component by using the first one as the base, and then adding the rest as siblings let mut final_component = components.remove(0); for component in components { diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index aaaa0308..09f68c4a 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -1,7 +1,7 @@ use crate::{movement::MoveDirection, Account, Player}; use azalea_auth::game_profile::GameProfile; use azalea_chat::component::Component; -use azalea_core::{BlockPos, ChunkPos, ResourceLocation, Vec3}; +use azalea_core::{ChunkPos, ResourceLocation, Vec3}; use azalea_protocol::{ connect::{Connection, ConnectionError, ReadConnection, WriteConnection}, packets::{ |
