diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-21 19:32:25 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-21 19:32:25 +0200 |
commit | ddb74305365f0a646dd2ab0fa7959accf88d44ba (patch) | |
tree | 2fce3688a3e466b77e7d340d7b6e1ec8cefa47c9 | |
parent | 170ae3a781598a3d536f8709819dff476e0e59fe (diff) | |
parent | cd6b0368f6231fd2d34dc273022f04554e5e74d9 (diff) | |
download | redot-engine-ddb74305365f0a646dd2ab0fa7959accf88d44ba.tar.gz |
Merge pull request #80847 from bruvzg/rtl_rem_para
[RTL] Fix `remove_paragraph` crashes
-rw-r--r-- | scene/gui/rich_text_label.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 4780ce873c..f48de85760 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -3213,17 +3213,19 @@ bool RichTextLabel::remove_paragraph(const int p_paragraph) { if (!had_newline) { current_frame->lines.remove_at(p_paragraph); - if (current_frame->lines.size() == 0) { - current_frame->lines.resize(1); - } + } + + if (current_frame->lines.is_empty()) { + current_frame->lines.resize(1); } if (p_paragraph == 0 && current->subitems.size() > 0) { main->lines[0].from = main; } - int to_line = main->first_invalid_line.load(); - main->first_invalid_line.store(MIN(to_line, p_paragraph)); + main->first_invalid_line.store(MIN(main->first_invalid_line.load(), p_paragraph)); + main->first_resized_line.store(MIN(main->first_resized_line.load(), p_paragraph)); + main->first_invalid_font_line.store(MIN(main->first_invalid_font_line.load(), p_paragraph)); queue_redraw(); return true; |