diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-04-13 18:17:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 18:17:52 +0200 |
commit | 853e651b2894e914fc4781936edbed2e17ce5566 (patch) | |
tree | 0ae709f2f23bd6809210b6585d6ec662a1b56a1f /scene/gui/rich_text_label.cpp | |
parent | d9991160545be05cebc9dea161eaf5b4d855e7db (diff) | |
parent | 6530e55f2d313941800994168dcb902c346fc2da (diff) |
Merge pull request #60209 from ConteZero/select_all_null
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
-rw-r--r-- | scene/gui/rich_text_label.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index c00298ff2f..ec13399f82 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -4257,7 +4257,7 @@ void RichTextLabel::select_all() { while (it) { if (it->type != ITEM_FRAME) { - if (from_item == nullptr) { + if (!from_item) { from_item = it; } else { to_item = it; @@ -4265,13 +4265,22 @@ void RichTextLabel::select_all() { } it = _get_next_item(it, true); } + if (!from_item || !to_item) { + return; + } ItemFrame *from_frame = nullptr; int from_line = 0; _find_frame(from_item, &from_frame, &from_line); + if (!from_frame) { + return; + } ItemFrame *to_frame = nullptr; int to_line = 0; _find_frame(to_item, &to_frame, &to_line); + if (!to_frame) { + return; + } selection.from_line = from_line; selection.from_frame = from_frame; selection.from_char = 0; |