diff options
author | Ev1lbl0w <ricasubtil@gmail.com> | 2021-10-24 22:38:06 +0100 |
---|---|---|
committer | Ev1lbl0w <ricasubtil@gmail.com> | 2021-11-10 12:44:40 +0000 |
commit | 184366251025a5e4dbccc97ffb7aae60921b3e4c (patch) | |
tree | 019f82729d5af0fdf7a6a46d26e29db28b3e698c | |
parent | e71184667ef09e2cd797219ceb598988a9b33801 (diff) |
Fix crash with indexing array with bad values
-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 8cb3b23020..987664dff6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3682,8 +3682,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; } |