summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-11 14:02:01 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-11 14:02:01 +0100
commit863324330b407161d42db452b02d7d0d4d1375fc (patch)
tree595cc0cea99ec9dcd10a153cfd8401bb9ccee35b
parentcc8f594ac42f980d62b4ee221166ee834e9306f1 (diff)
parent1d30653efbe7ad72f7e0c376c7831f5354d93fee (diff)
Merge pull request #71219 from EricEzaM/68176-codeedit_update_code_completion_options_crash
Fix crash in CodeEdit when caret column exceeds line length.
-rw-r--r--scene/gui/code_edit.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 680e4260e7..7539810feb 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -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();