summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/subtitle_content.cc6
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);