]> 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>
Mon, 30 Nov 2015 14:33:01 +0000 (15:33 +0100)
refs #10711

lib/remote/apilistener.cpp

index 2deb0329a4eef5ed0fc0eaa35f7d9512d3e72b84..d4269d8c9397a65e129351b264f5a6c02e141e41 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);
 
        {