Merge pull request #54204 from Ev1lbl0w/bugfix-textedit_selection_mode_crash

This commit is contained in:
Rémi Verschelde 2021-11-10 19:03:33 +01:00 committed by GitHub
commit b46a42b689
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}