diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-10 19:03:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 19:03:33 +0100 |
commit | b46a42b689ac3c7396216153799f1324ca7b6356 (patch) | |
tree | fdcd19c66eb635f13e57b4bbeccc0f904f87df99 | |
parent | 5cc0ad53936dc7bc20302f36628d166739c678dc (diff) | |
parent | 184366251025a5e4dbccc97ffb7aae60921b3e4c (diff) |
Merge pull request #54204 from Ev1lbl0w/bugfix-textedit_selection_mode_crash
-rw-r--r-- | scene/gui/text_edit.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cb7a6c0978..27f272a12d 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3697,8 +3697,10 @@ void TextEdit::set_selection_mode(SelectionMode p_mode, int p_line, int p_column if (p_line >= 0) { ERR_FAIL_INDEX(p_line, text.size()); selection.selecting_line = p_line; + selection.selecting_column = CLAMP(selection.selecting_column, 0, text[selection.selecting_line].length()); } if (p_column >= 0) { + ERR_FAIL_INDEX(selection.selecting_line, text.size()); ERR_FAIL_INDEX(p_column, text[selection.selecting_line].length()); selection.selecting_column = p_column; } |