mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 05:35:36 +00:00
fix crash when failing to save file.
https://gna.org/bugs/index.php?23301
This commit is contained in:
parent
f2e4d3c875
commit
d12c594d90
@ -786,8 +786,15 @@ std::ostream *ostream_file(std::string const &fname)
|
||||
{
|
||||
LOG_FS << "streaming " << fname << " for writing.\n";
|
||||
#if 1
|
||||
boost::iostreams::file_descriptor_sink fd(iostream_path(fname), std::ios_base::binary);
|
||||
return new boost::iostreams::stream<boost::iostreams::file_descriptor_sink>(fd, 4096, 0);
|
||||
try
|
||||
{
|
||||
boost::iostreams::file_descriptor_sink fd(iostream_path(fname), std::ios_base::binary);
|
||||
return new boost::iostreams::stream<boost::iostreams::file_descriptor_sink>(fd, 4096, 0);
|
||||
}
|
||||
catch(BOOST_IOSTREAMS_FAILURE& e)
|
||||
{
|
||||
throw filesystem::io_exception(e.what());
|
||||
}
|
||||
#else
|
||||
return new bfs::ofstream(path(fname), std::ios_base::binary);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user