From eb044e13ca3c29093566c1f692474299e581a5de Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Sat, 16 Sep 2017 22:55:38 +0200 Subject: [PATCH] Check that the file exists instead of crashing - It closes issue #15. --- src/blupi.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/blupi.cxx b/src/blupi.cxx index 30b3e6f..a859e14 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -114,7 +114,10 @@ ReadConfig () { const auto config = GetBaseDir () + "data/config.json"; - std::ifstream file (config, std::ifstream::in); + std::ifstream file (config, std::ifstream::in); + if (!file) + return false; + nlohmann::json j; file >> j;