diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-04 15:39:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-04 15:39:35 +0100 |
| commit | 359ec2977ec93d2d04fb9bcadbfad6e69fbf1a3e (patch) | |
| tree | 870c418a6280583f62db7b15b3a55f5bb706d1ab /src/subtitle_content.cc | |
| parent | bd491319f52ba7f37ef5763960b4c0c00434b5f9 (diff) | |
Fix fopen call and throw an exception if it fails.
Diffstat (limited to 'src/subtitle_content.cc')
| -rw-r--r-- | src/subtitle_content.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/subtitle_content.cc b/src/subtitle_content.cc index 7e11dea4..5a45d737 100644 --- a/src/subtitle_content.cc +++ b/src/subtitle_content.cc @@ -238,7 +238,11 @@ struct SubtitleSorter { void SubtitleContent::write_xml (boost::filesystem::path p) const { - FILE* f = fopen_boost (p, "r"); + FILE* f = fopen_boost (p, "w"); + if (!f) { + throw FileError ("Could not open file for writing", p, -1); + } + Glib::ustring const s = xml_as_string (); fwrite (s.c_str(), 1, s.length(), f); fclose (f); |
