mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Fix not handling failbit/badbit in ifstream (Bug #1355)
This commit is contained in:
parent
b470596206
commit
a0bff03560
@ -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…
x
Reference in New Issue
Block a user