From 866f9d21fc6b9d857328b5c2e416a514b467c83f Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Wed, 29 Apr 2009 19:30:02 +0000 Subject: [PATCH] Let AudioProvider::GetAudioWithVolume() catch exceptions in AudioProvider::GetAudio() and return blank audio when that happens. Errors are not logged or otherwise handled. This fixes #800 for most cases, even if poorly. Originally committed to SVN as r2883. --- aegisub/src/audio_provider.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aegisub/src/audio_provider.cpp b/aegisub/src/audio_provider.cpp index 2758f2019..aadf4324e 100644 --- a/aegisub/src/audio_provider.cpp +++ b/aegisub/src/audio_provider.cpp @@ -175,7 +175,16 @@ void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int ///////////////////////// // Get audio with volume void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) { - GetAudio(buf,start,count); + try { + GetAudio(buf,start,count); + } + catch (...) { + // FIXME: Poor error handling though better than none, to patch issue #800. + // Just return blank audio if real provider fails. + memset(buf, 0, count*bytes_per_sample); + return; + } + if (volume == 1.0) return; if (bytes_per_sample == 2) {