aboutsummaryrefslogtreecommitdiff
path: root/minecraft-chat
diff options
context:
space:
mode:
Diffstat (limited to 'minecraft-chat')
-rw-r--r--minecraft-chat/src/text_component.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/minecraft-chat/src/text_component.rs b/minecraft-chat/src/text_component.rs
index a5030fa1..25341086 100644
--- a/minecraft-chat/src/text_component.rs
+++ b/minecraft-chat/src/text_component.rs
@@ -27,9 +27,7 @@ pub fn legacy_color_code_to_text_component(legacy_color_code: &str) -> TextCompo
if legacy_color_code.chars().nth(i).unwrap() == LEGACY_FORMATTING_CODE_SYMBOL {
let formatting_code = legacy_color_code.chars().nth(i + 1).unwrap();
if let Ok(formatter) = ChatFormatting::from_code(formatting_code) {
- if components.is_empty() {
- components.push(TextComponent::new("".to_string()));
- } else if !components.last().unwrap().text.is_empty() {
+ if components.is_empty() || !components.last().unwrap().text.is_empty() {
components.push(TextComponent::new("".to_string()));
}