You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Validate custom type script before loading it
This commit is contained in:
@@ -306,5 +306,12 @@ Ref<Script> PropertyUtils::get_custom_type_script(const Object *p_object) {
|
||||
return script_object;
|
||||
}
|
||||
#endif
|
||||
ResourceUID::ID id = ResourceUID::get_singleton()->text_to_id(custom_script);
|
||||
if (unlikely(id == ResourceUID::INVALID_ID || !ResourceUID::get_singleton()->has_id(id))) {
|
||||
const_cast<Object *>(p_object)->remove_meta(SceneStringName(_custom_type_script));
|
||||
ERR_FAIL_V_MSG(Ref<Script>(), vformat("Invalid custom type script UID: %s. Removing.", custom_script.operator String()));
|
||||
} else {
|
||||
custom_script = ResourceUID::get_singleton()->get_id_path(id);
|
||||
}
|
||||
return ResourceLoader::load(custom_script);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user