mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
don't panic if TranslatableComponent::to_string fails
This commit is contained in:
parent
e511ad3c31
commit
1b6e024460
1 changed files with 4 additions and 1 deletions
|
@ -133,7 +133,10 @@ impl Display for TranslatableComponent {
|
||||||
for component in FormattedText::Translatable(self.clone()).into_iter() {
|
for component in FormattedText::Translatable(self.clone()).into_iter() {
|
||||||
let component_text = match &component {
|
let component_text = match &component {
|
||||||
FormattedText::Text(c) => c.text.to_string(),
|
FormattedText::Text(c) => c.text.to_string(),
|
||||||
FormattedText::Translatable(c) => c.read()?.to_string(),
|
FormattedText::Translatable(c) => match c.read() {
|
||||||
|
Ok(c) => c.to_string(),
|
||||||
|
Err(_) => c.key.to_string(),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
f.write_str(&component_text)?;
|
f.write_str(&component_text)?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue