Skip to content

Commit

Permalink
Implement proper error print, Fixes a crash when no error messages ar…
Browse files Browse the repository at this point in the history
…e generated by the analyser.
  • Loading branch information
AndreaCatania committed Nov 28, 2020
1 parent f733746 commit 40403b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/gdscript/gdscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,12 @@ Error GDScript::reload(bool p_keep_state) {
if (EngineDebugger::is_active()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), parser.get_errors().front()->get().line, "Parser Error: " + parser.get_errors().front()->get().message);
}
// TODO: Show all error messages.
_err_print_error("GDScript::reload", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_errors().front()->get().line, ("Parse Error: " + parser.get_errors().front()->get().message).utf8().get_data(), ERR_HANDLER_SCRIPT);

const List<GDScriptParser::ParserError>::Element *e = parser.get_errors().front();
while (e != nullptr) {
_err_print_error("GDScript::reload", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), e->get().line, ("Parse Error: " + e->get().message).utf8().get_data(), ERR_HANDLER_SCRIPT);
e = e->next();
}
ERR_FAIL_V(ERR_PARSE_ERROR);
}

Expand Down

0 comments on commit 40403b0

Please sign in to comment.