summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-10-17 15:33:38 +0300
committerGitHub <noreply@github.com>2021-10-17 15:33:38 +0300
commit468b987aa38b21b55c1cd8a8d4c03b8e1b2a1373 (patch)
tree403438b3d7f77a2bdf49c662091fa7a48341d403
parent5bf01654d75f9493fba6761c9c360fef3019f082 (diff)
parent88985cbf3a45887f379faca2d6658e1f41e879bb (diff)
Merge pull request #53881 from Ev1lbl0w/fix_textedit_null_crash
-rw-r--r--scene/gui/text_edit.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index dc9a3f337e..f03eebd543 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3623,6 +3623,8 @@ int TextEdit::get_caret_wrap_index() const {
}
String TextEdit::get_word_under_caret() const {
+ ERR_FAIL_INDEX_V(caret.line, text.size(), "");
+ ERR_FAIL_INDEX_V(caret.column, text[caret.line].length() + 1, "");
PackedInt32Array words = TS->shaped_text_get_word_breaks(text.get_line_data(caret.line)->get_rid());
for (int i = 0; i < words.size(); i = i + 2) {
if (words[i] <= caret.column && words[i + 1] > caret.column) {