diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index d0b342a75..6853f0010 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -53,6 +53,11 @@ ApiListener::ApiListener(void) void ApiListener::OnConfigLoaded(void) { + if (m_Instance) + BOOST_THROW_EXCEPTION(ScriptError("Only one ApiListener object is allowed.", GetDebugInfo())); + + m_Instance = this; + /* set up SSL context */ boost::shared_ptr cert; try { @@ -104,11 +109,6 @@ void ApiListener::Start(bool runtimeCreated) { SyncZoneDirs(); - if (m_Instance) - BOOST_THROW_EXCEPTION(ScriptError("Only one ApiListener object is allowed.", GetDebugInfo())); - - m_Instance = this; - ObjectImpl::Start(runtimeCreated); {