From 6d3d90211a9e32cbb0b5c92df5b533cdaa730aa4 Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 27 Nov 2018 22:48:58 +0100 Subject: [PATCH] Improved some errorhandling --- deps/watchdog/Watchdog.h | 6 ++++++ src/common/Config/ConfigMgr.cpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/deps/watchdog/Watchdog.h b/deps/watchdog/Watchdog.h index 735c0c6e..d9f7aa25 100644 --- a/deps/watchdog/Watchdog.h +++ b/deps/watchdog/Watchdog.h @@ -119,7 +119,13 @@ protected: // keep watching for modifications every ms milliseconds auto ms = std::chrono::milliseconds( 500 ); while( mWatching ) { + if( mFileWatchers.empty() ) + { + std::this_thread::sleep_for( ms ); + continue; + } do { + // iterate through each watcher and check for modification std::lock_guard lock( mMutex ); auto end = mFileWatchers.end(); diff --git a/src/common/Config/ConfigMgr.cpp b/src/common/Config/ConfigMgr.cpp index 1fdc9af0..8b72bf1a 100644 --- a/src/common/Config/ConfigMgr.cpp +++ b/src/common/Config/ConfigMgr.cpp @@ -17,7 +17,8 @@ bool Core::ConfigMgr::loadConfig( const std::string& configName ) if( !fs::exists( configFile ) ) { - copyDefaultConfig( configName ); + if( !copyDefaultConfig( configName ) ) + return false; } m_pInih = std::unique_ptr< INIReader >( new INIReader( configFile.string() ) );