Check whether there's an application instance before calling Shutdown().

This commit is contained in:
Gunnar Beutner 2012-06-20 15:23:10 +02:00
parent 77029763cf
commit 49c7cd27d2
1 changed files with 13 additions and 2 deletions

View File

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