From b40e63566a5ea50fd33471b96b51b9922bb5f80f Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 29 Oct 2025 22:45:13 +0800 Subject: [PATCH] Fix error when deleting trailing lines removed breakpoints --- editor/script/script_text_editor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/script/script_text_editor.cpp b/editor/script/script_text_editor.cpp index 8e17183df8f..364beb5f206 100644 --- a/editor/script/script_text_editor.cpp +++ b/editor/script/script_text_editor.cpp @@ -1242,7 +1242,9 @@ void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) { } void ScriptTextEditor::_breakpoint_toggled(int p_row) { - EditorDebuggerNode::get_singleton()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_editor()->is_line_breakpointed(p_row)); + const CodeEdit *ce = code_editor->get_text_editor(); + bool enabled = p_row < ce->get_line_count() && ce->is_line_breakpointed(p_row); + EditorDebuggerNode::get_singleton()->set_breakpoint(script->get_path(), p_row + 1, enabled); } void ScriptTextEditor::_on_caret_moved() {