From 9b1de189be0ca5d356cb0b90a3b2c184f7a0eb0f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 2 Jul 2012 11:04:20 +0200 Subject: [PATCH] Check whether file was successfully opened. --- dyn/configcompiler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dyn/configcompiler.cpp b/dyn/configcompiler.cpp index ca572cb6c..e94de6301 100644 --- a/dyn/configcompiler.cpp +++ b/dyn/configcompiler.cpp @@ -70,6 +70,9 @@ vector 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); -- 2.40.0