summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-14 14:13:00 +0200
committerGitHub <noreply@github.com>2021-09-14 14:13:00 +0200
commitce8dbef6a00520ae5f390640559d119bce048228 (patch)
tree1473e5c1dab55335358d04e6b5e75298836d0949 /editor
parentc110b294e910c6ede64801ba1030ee527d465e80 (diff)
parent6a9e855af96c2aa6dc593af3432578553660ee2f (diff)
Merge pull request #52662 from Chaosus/fix_bookmarks
Fix editor crash on pressing `Go to Previous Bookmark` menu button
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/plugins/script_text_editor.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 6764ebcc4e..8aa5d62f98 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1755,7 +1755,7 @@ void CodeTextEditor::goto_prev_bookmark() {
text_editor->set_caret_line(bmarks[bmarks.size() - 1]);
text_editor->center_viewport_to_caret();
} else {
- for (int i = bmarks.size(); i >= 0; i--) {
+ for (int i = bmarks.size() - 1; i >= 0; i--) {
int bmark_line = bmarks[i];
if (bmark_line < line) {
text_editor->unfold_line(bmark_line);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 48239a5d99..89d91cc079 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1242,7 +1242,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
tx->set_caret_line(bpoints[bpoints.size() - 1]);
tx->center_viewport_to_caret();
} else {
- for (int i = bpoints.size(); i >= 0; i--) {
+ for (int i = bpoints.size() - 1; i >= 0; i--) {
int bline = bpoints[i];
if (bline < line) {
tx->unfold_line(bline);