summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2021-09-07 19:25:40 +0200
committerGitHub <noreply@github.com>2021-09-07 19:25:40 +0200
commit06b4a48444e42e8e5587572e1d7216a38a6bc7fa (patch)
tree0f31b5940f8e34ec952ad904cf263d19a469ddb0
parent72ac4706150c83cfa312977342b046f03ab2ea17 (diff)
parent8a8c172b93982bc530f85a45743fe8e44be5bf0e (diff)
Merge pull request #52436 from daniel-mcclintock/fix-out-of-bounds-completion-crash
Fix crash during completion lookback
-rw-r--r--scene/gui/code_edit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 5f3ab18cca..955410f890 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -2744,7 +2744,7 @@ void CodeEdit::_filter_code_completion_candidates_impl() {
/* If we have a space, previous word might be a keyword. eg "func |". */
} else if (cofs > 0 && line[cofs - 1] == ' ') {
int ofs = cofs - 1;
- while (ofs >= 0 && line[ofs] == ' ') {
+ while (ofs > 0 && line[ofs] == ' ') {
ofs--;
}
prev_is_word = _is_char(line[ofs]);