From aa258c6c122dc8994350cc3cf64559a4e08fb154 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Tue, 20 Feb 2024 12:15:17 -0300 Subject: [PATCH] Fix `RichTextLabel`'s tag stack being overridden on translation change --- scene/gui/rich_text_label.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index b6dd953d5056..4f25fed335c9 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -5650,10 +5650,15 @@ void RichTextLabel::set_text(const String &p_bbcode) { } void RichTextLabel::_apply_translation() { + // If `text` is empty, it could mean that the tag stack is being used instead. Leave it be. + if (text.is_empty()) { + return; + } + String xl_text = atr(text); if (use_bbcode) { parse_bbcode(xl_text); - } else { // raw text + } else { // Raw text. clear(); add_text(xl_text); }