diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-04-16 09:56:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-04-16 09:56:12 +0100 |
| commit | 91bd51ff82e99113860570b519459303802bd98f (patch) | |
| tree | 377fdd26be524b0a8f4273b09ba7b9d1298d392a /src/lib/audio_analysis.cc | |
| parent | cf0c9b44c5ec1884176a07f8f2c383ac505569a4 (diff) | |
A few missing checks on the return value of fopen_boost.
Diffstat (limited to 'src/lib/audio_analysis.cc')
| -rw-r--r-- | src/lib/audio_analysis.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index 597c04a22..19a0d876e 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -90,6 +90,9 @@ AudioAnalysis::AudioAnalysis (int channels) AudioAnalysis::AudioAnalysis (boost::filesystem::path filename) { FILE* f = fopen_boost (filename, "r"); + if (!f) { + throw OpenFileError (filename); + } int channels = 0; fscanf (f, "%d", &channels); @@ -149,6 +152,9 @@ AudioAnalysis::write (boost::filesystem::path filename) tmp.replace_extension (".tmp"); FILE* f = fopen_boost (tmp, "w"); + if (!f) { + throw OpenFileError (tmp); + } fprintf (f, "%ld\n", _data.size ()); for (vector<vector<AudioPoint> >::iterator i = _data.begin(); i != _data.end(); ++i) { |
