mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 09:09:40 +00:00
Fix not handling failbit/badbit in ifstream (Bug #1355)
This commit is contained in:
parent
b470596206
commit
a0bff03560
1 changed files with 4 additions and 0 deletions
|
@ -32,6 +32,9 @@ namespace Translation
|
|||
boost::filesystem::ifstream stream (
|
||||
dataFileCollections.getCollection (extension).getPath (fileName));
|
||||
|
||||
// Configure the stream to throw exception upon error
|
||||
stream.exceptions ( boost::filesystem::ifstream::failbit | boost::filesystem::ifstream::badbit );
|
||||
|
||||
if (!stream.is_open())
|
||||
throw std::runtime_error ("failed to open translation file: " + fileName);
|
||||
|
||||
|
@ -41,6 +44,7 @@ namespace Translation
|
|||
|
||||
void Storage::loadDataFromStream(ContainerType& container, std::istream& stream)
|
||||
{
|
||||
// NOTE: does not handle failbit/badbit. stream must be set up beforehand to throw in these cases.
|
||||
std::string line;
|
||||
while (!stream.eof())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue