You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Returns null and does not cache when the source code of the script fails to load
This usually means that an `ERR_FILE*` error occurred. Previously, using `GDScriptCache::get_full_script()` would ignore errors during loading. Now, all errors are not ignored. Judging in which period the error occurred, it can be judged based on the return value: 1. null + err : Error during script loading (load_source_code()). 2. script + err: Error during script parsing.
This commit is contained in:
@@ -253,7 +253,11 @@ Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, Error &r_e
|
||||
Ref<GDScript> script;
|
||||
script.instantiate();
|
||||
script->set_path(p_path, true);
|
||||
script->load_source_code(p_path);
|
||||
r_error = script->load_source_code(p_path);
|
||||
|
||||
if (r_error) {
|
||||
return Ref<GDScript>(); // Returns null and does not cache when the script fails to load.
|
||||
}
|
||||
|
||||
Ref<GDScriptParserRef> parser_ref = get_parser(p_path, GDScriptParserRef::PARSED, r_error);
|
||||
if (r_error == OK) {
|
||||
|
||||
Reference in New Issue
Block a user