From 4e6068969527ae4f55adf24865d511727d1da3b4 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Sun, 27 Nov 2022 10:31:53 -0500 Subject: [PATCH] Fix cyclic reference base being loaded but not valid (which is ok) --- modules/gdscript/gdscript_cache.cpp | 2 +- modules/gdscript/gdscript_compiler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index 2e7263b6521..5fbdf8c4322 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -260,7 +260,7 @@ Ref GDScriptCache::get_full_script(const String &p_path, Error &r_erro Ref script; r_error = OK; if (singleton->full_gdscript_cache.has(p_path)) { - script = Ref(singleton->full_gdscript_cache[p_path]); + script = singleton->full_gdscript_cache[p_path]; if (!p_update_from_disk) { return script; } diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index f0ceb42f89c..103eb60da95 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -2284,7 +2284,7 @@ Error GDScriptCompiler::_populate_class_members(GDScript *p_script, const GDScri _set_error(vformat(R"(Could not find class "%s" in "%s".)", base->fully_qualified_name, base->path), nullptr); return ERR_COMPILATION_FAILED; } - ERR_FAIL_COND_V(!base->is_valid(), ERR_BUG); + ERR_FAIL_COND_V(!base->is_valid() && !base->reloading, ERR_BUG); } p_script->base = base;