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()