From e9202916b21932d3b06b1aa38c8d8ed4ea1cfb7e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 19 Nov 2024 19:50:57 +0000 Subject: [PATCH] Emplace services when registering them with the core. --- include/service.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/service.h b/include/service.h index 87a04ece1..dfbe2207a 100644 --- a/include/service.h +++ b/include/service.h @@ -98,10 +98,8 @@ public: void Register() { - std::map &smap = Services[this->type]; - if (smap.find(this->name) != smap.end()) + if (!Services[this->type].emplace(this->name, this).second) throw ModuleException("Service " + this->type + " with name " + this->name + " already exists"); - smap[this->name] = this; } void Unregister()