]> granicus.if.org Git - icinga2/commitdiff
Fix: Crash when state file is invalid.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 28 Jan 2014 13:32:56 +0000 (14:32 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 28 Jan 2014 13:33:21 +0000 (14:33 +0100)
Fixes #5361

lib/config/configitem.cpp

index f9c18ce69737615acf06b9443a32f328299eaede..942df69f85bba257d2e8b0cf8742d3648c25e0da 100644 (file)
@@ -26,6 +26,7 @@
 #include "base/logger_fwd.h"
 #include "base/debug.h"
 #include "base/workqueue.h"
+#include "base/exception.h"
 #include <sstream>
 #include <boost/foreach.hpp>
 
@@ -326,7 +327,11 @@ bool ConfigItem::ActivateItems(bool validateOnly)
                return true;
 
        /* restore the previous program state */
-       DynamicObject::RestoreObjects(Application::GetStatePath());
+       try {
+               DynamicObject::RestoreObjects(Application::GetStatePath());
+       } catch (const std::exception& ex) {
+               Log(LogCritical, "config", "Failed to restore state file: " + DiagnosticInformation(ex));
+       }
 
        Log(LogInformation, "config", "Triggering Start signal for config items");