From a938359cd33099116a40724a5b1bfe422cdd8744 Mon Sep 17 00:00:00 2001 From: rune-scape Date: Fri, 29 Dec 2023 18:05:58 -0800 Subject: [PATCH] Fix possible crash in script_text_editor.cpp --- editor/plugins/script_text_editor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index eb934da4dd3..dbaaecf9b3d 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -500,11 +500,14 @@ void ScriptTextEditor::_validate_script() { safe_lines.clear(); if (!script->get_language()->validate(text, script->get_path(), &fnc, &errors, &warnings, &safe_lines)) { - for (List::Element *E = errors.front(); E; E = E->next()) { + List::Element *E = errors.front(); + while (E) { + List::Element *next_E = E->next(); if ((E->get().path.is_empty() && !script->get_path().is_empty()) || E->get().path != script->get_path()) { depended_errors[E->get().path].push_back(E->get()); E->erase(); } + E = next_E; } if (errors.size() > 0) {