Merge pull request #53148 from Shatur/fix-register-singleton

Fix inversed check inside register_singleton
This commit is contained in:
Rémi Verschelde 2021-09-27 23:49:36 +02:00 committed by GitHub
commit 8abd46096a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2221,7 +2221,7 @@ Object *Engine::get_singleton_object(const StringName &p_name) const {
void Engine::register_singleton(const StringName &p_name, Object *p_object) {
ERR_FAIL_COND_MSG(has_singleton(p_name), "Singleton already registered: " + String(p_name));
ERR_FAIL_COND_MSG(p_name.operator String().is_valid_identifier(), "Singleton name is not a valid identifier: " + String(p_name));
ERR_FAIL_COND_MSG(!String(p_name).is_valid_identifier(), "Singleton name is not a valid identifier: " + p_name);
::Engine::Singleton s;
s.class_name = p_name;
s.name = p_name;