diff --git a/src/common/profile.cpp b/src/common/profile.cpp index 2fddd513..c43cd756 100644 --- a/src/common/profile.cpp +++ b/src/common/profile.cpp @@ -59,16 +59,21 @@ bool CProfile::Init() try { std::unique_ptr stream; + bool good = false; if (m_useCurrentDirectory) { - stream = std::unique_ptr(new std::ifstream("./colobot.ini")); + std::ifstream* inputStream = new std::ifstream("./colobot.ini"); + stream = std::unique_ptr(inputStream); + good = inputStream->good(); } else { - stream = std::unique_ptr(new CInputStream("colobot.ini")); + CInputStream* inputStream = new CInputStream("colobot.ini"); + stream = std::unique_ptr(inputStream); + good = inputStream->is_open(); } - if (stream->good()) + if (good) { bp::ini_parser::read_ini(*stream, m_propertyTree); }