Check whether file was successfully opened.

This commit is contained in:
Gunnar Beutner 2012-07-02 11:04:20 +02:00
parent 7d5ab3d890
commit 9b1de189be
1 changed files with 3 additions and 0 deletions

View File

@ -70,6 +70,9 @@ vector<ConfigItem::Ptr> ConfigCompiler::CompileFile(const string& filename)
stream.exceptions(ifstream::badbit);
stream.open(filename.c_str(), ifstream::in);
if (!stream.good())
throw invalid_argument("Could not open config file: " + filename);
Application::Log(LogInformation, "dyn", "Compiling config file: " + filename);
return CompileStream(&stream);