decoder/flac: throw exception on FLAC__stream_decoder_new() failure
This commit is contained in:
parent
74740ca50b
commit
3b031c6ba5
@ -120,12 +120,6 @@ static FlacStreamDecoder
|
||||
flac_decoder_new(void)
|
||||
{
|
||||
FlacStreamDecoder sd;
|
||||
if (!sd) {
|
||||
LogError(flac_domain,
|
||||
"FLAC__stream_decoder_new() failed");
|
||||
return sd;
|
||||
}
|
||||
|
||||
if(!FLAC__stream_decoder_set_metadata_respond(sd.get(), FLAC__METADATA_TYPE_VORBIS_COMMENT))
|
||||
LogDebug(flac_domain,
|
||||
"FLAC__stream_decoder_set_metadata_respond() has failed");
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <FLAC/stream_decoder.h>
|
||||
|
||||
#include <utility>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@ -36,7 +37,10 @@ class FlacStreamDecoder {
|
||||
|
||||
public:
|
||||
FlacStreamDecoder()
|
||||
:decoder(FLAC__stream_decoder_new()) {}
|
||||
:decoder(FLAC__stream_decoder_new()) {
|
||||
if (decoder == nullptr)
|
||||
throw std::runtime_error("FLAC__stream_decoder_new() failed");
|
||||
}
|
||||
|
||||
FlacStreamDecoder(FlacStreamDecoder &&src)
|
||||
:decoder(src.decoder) {
|
||||
|
Loading…
Reference in New Issue
Block a user