Fixed crash when colobot.ini doesn't exist
parent
47ea8a1175
commit
63b6aa56b0
|
@ -59,16 +59,21 @@ bool CProfile::Init()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::unique_ptr<std::istream> stream;
|
std::unique_ptr<std::istream> stream;
|
||||||
|
bool good = false;
|
||||||
if (m_useCurrentDirectory)
|
if (m_useCurrentDirectory)
|
||||||
{
|
{
|
||||||
stream = std::unique_ptr<std::istream>(new std::ifstream("./colobot.ini"));
|
std::ifstream* inputStream = new std::ifstream("./colobot.ini");
|
||||||
|
stream = std::unique_ptr<std::istream>(inputStream);
|
||||||
|
good = inputStream->good();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream = std::unique_ptr<std::istream>(new CInputStream("colobot.ini"));
|
CInputStream* inputStream = new CInputStream("colobot.ini");
|
||||||
|
stream = std::unique_ptr<std::istream>(inputStream);
|
||||||
|
good = inputStream->is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->good())
|
if (good)
|
||||||
{
|
{
|
||||||
bp::ini_parser::read_ini(*stream, m_propertyTree);
|
bp::ini_parser::read_ini(*stream, m_propertyTree);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue