]> granicus.if.org Git - icinga2/commitdiff
Fix incorrect return value for ApiListener::GetInstance
authorGunnar Beutner <gunnar@beutner.name>
Mon, 30 Nov 2015 14:31:11 +0000 (15:31 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 08:25:35 +0000 (09:25 +0100)
refs #10711

lib/remote/apilistener.cpp

index d0b342a7580e0114539e2de3812ec7d4ff3ef6bd..6853f0010ef58cf2b5af0c37db4c77c9056272e0 100644 (file)
@@ -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<X509> 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<ApiListener>::Start(runtimeCreated);
 
        {