GDScript: Make check for exposed classes more consistent

Some places were already checking if classes from ClassDB were exposed,
while others didn't. This makes the check more consistent to avoid
disparities which can lead to crashes.
This commit is contained in:
George Marques committed 2025-11-25 12:24:18 -03:00
1 parent 22a28e07cc
commit 501c5b0900
5 files changed
+18 -17

No files matched your search

+1 -1
View File
@@ -4677,7 +4677,7 @@ bool GDScriptParser::export_annotations(AnnotationNode *p_annotation, Node *p_ta
if (ScriptServer::is_global_class(arg_string)) {
native_class = ScriptServer::get_global_class_native_base(arg_string);
}
if (!ClassDB::class_exists(native_class)) {
if (!ClassDB::class_exists(native_class) || !ClassDB::is_class_exposed(native_class)) {
push_error(vformat(R"(Invalid argument %d of annotation "@export_node_path": The class "%s" was not found in the global scope.)", i + 1, arg_string), p_annotation->arguments[i]);
return false;
} else if (!ClassDB::is_parent_class(native_class, SNAME("Node"))) {