Fix crash with indexing array with bad values
This commit is contained in:
parent
e71184667e
commit
1843662510
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue