You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
GDScript: Fix crash when superclass file is non-existent
Incidentally, allow EOF to be an end of statement.
This commit is contained in:
@@ -85,6 +85,17 @@ Error GDScriptParserRef::raise_status(Status p_new_status) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (result != OK) {
|
||||
if (parser != nullptr) {
|
||||
memdelete(parser);
|
||||
parser = nullptr;
|
||||
}
|
||||
if (analyzer != nullptr) {
|
||||
memdelete(analyzer);
|
||||
analyzer = nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -118,6 +129,10 @@ Ref<GDScriptParserRef> GDScriptCache::get_parser(const String &p_path, GDScriptP
|
||||
if (singleton->parser_map.has(p_path)) {
|
||||
ref = singleton->parser_map[p_path];
|
||||
} else {
|
||||
if (!FileAccess::exists(p_path)) {
|
||||
r_error = ERR_FILE_NOT_FOUND;
|
||||
return ref;
|
||||
}
|
||||
GDScriptParser *parser = memnew(GDScriptParser);
|
||||
ref.instance();
|
||||
ref->parser = parser;
|
||||
|
||||
Reference in New Issue
Block a user