[colobot] 89/390: Fixed crash when colobot.ini doesn't exist
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:21:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch upstream/latest
in repository colobot.
commit 63b6aa56b01d3764f87eb9f3ddcde68bc98f0e6b
Author: krzys-h <krzys_h at interia.pl>
Date: Wed Oct 15 21:28:40 2014 +0200
Fixed crash when colobot.ini doesn't exist
---
src/common/profile.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/common/profile.cpp b/src/common/profile.cpp
index 2fddd51..c43cd75 100644
--- a/src/common/profile.cpp
+++ b/src/common/profile.cpp
@@ -59,16 +59,21 @@ bool CProfile::Init()
try
{
std::unique_ptr<std::istream> stream;
+ bool good = false;
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
{
- 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);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list