Merge pull request #71219 from EricEzaM/68176-codeedit_update_code_completion_options_crash

Fix crash in CodeEdit when caret column exceeds line length.
This commit is contained in:
Rémi Verschelde 2023-01-11 14:02:01 +01:00
commit 863324330b
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2899,6 +2899,7 @@ void CodeEdit::_filter_code_completion_candidates_impl() {
const int caret_line = get_caret_line();
const int caret_column = get_caret_column();
const String line = get_line(caret_line);
ERR_FAIL_INDEX_MSG(caret_column - 1, line.length(), "Caret column exceeds line length.");
if (caret_column > 0 && line[caret_column - 1] == '(' && !code_completion_forced) {
cancel_code_completion();