Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RTL] Fix remove_paragraph crashes #80847

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[RTL] Fix remove_paragraph crashes.
  • Loading branch information
bruvzg committed Aug 21, 2023
commit cd6b0368f6231fd2d34dc273022f04554e5e74d9
12 changes: 7 additions & 5 deletions scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down