summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-06-26 22:24:05 +0200
committerMax Kellermann <max@musicpd.org>2019-06-26 22:40:27 +0200
commitea639269d8b0ae3db06c46d546d54896a8d8c89e (patch)
treeaf4d0faa16f9ea66ebb340f091e436b5fb3f8c6b /src
parent0abaa3ecc5d17f3578b8d1b34a63fdcca5d85a00 (diff)
decoder/wildmidi: throw PluginUnavailable on WildMidi_Init() error
Closes https://github.com/MusicPlayerDaemon/MPD/issues/589
Diffstat (limited to 'src')
-rw-r--r--src/decoder/plugins/WildmidiDecoderPlugin.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx
index 37bb026e2..a1dbee4f2 100644
--- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx
+++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx
@@ -21,6 +21,7 @@
#include "../DecoderAPI.hxx"
#include "tag/Handler.hxx"
#include "util/Domain.hxx"
+#include "util/ScopeExit.hxx"
#include "util/StringFormat.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx"
@@ -49,8 +50,14 @@ wildmidi_init(const ConfigBlock &block)
utf8.c_str()));
}
- return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
- 0) == 0;
+ WildMidi_ClearError();
+ AtScopeExit() { WildMidi_ClearError(); };
+
+ if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
+ 0) != 0)
+ throw PluginUnavailable(WildMidi_GetError());
+
+ return true;
}
static void