]> granicus.if.org Git - icinga2/commitdiff
Check whether there's an application instance before calling Shutdown().
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 20 Jun 2012 13:23:10 +0000 (15:23 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 20 Jun 2012 13:23:10 +0000 (15:23 +0200)
base/application.cpp

index ea479cbeb8c2b5c865ea4e219ff7c5ad426b6a76..0c75392cac1e50ba3f2c352c44a9faf88d0da2ac 100644 (file)
@@ -437,7 +437,12 @@ void Application::SigIntHandler(int signum)
 {
        assert(signum == SIGINT);
 
-       Application::GetInstance()->Shutdown();
+       Application::Ptr instance = Application::GetInstance();
+
+       if (!instance)
+               return;
+
+       instance->Shutdown();
 
        struct sigaction sa;
        memset(&sa, 0, sizeof(sa));
@@ -451,7 +456,13 @@ void Application::SigIntHandler(int signum)
  */
 BOOL WINAPI Application::CtrlHandler(DWORD type)
 {
-       Application::GetInstance()->Shutdown();
+       Application::Ptr instance = Application::GetInstance();
+
+       if (!instance)
+               return TRUE;
+
+       instance->GetInstance()->Shutdown();
+
        SetConsoleCtrlHandler(NULL, FALSE);
        return TRUE;
 }