From 1d30653efbe7ad72f7e0c376c7831f5354d93fee Mon Sep 17 00:00:00 2001 From: Eric M Date: Wed, 11 Jan 2023 22:40:05 +1000 Subject: [PATCH] Fix crash in CodeEdit when caret column exceeds line length. --- scene/gui/code_edit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 680e4260e7d..7539810feb9 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();