From 1bc553ea62b4cf6e16d0cfdb6eaf206d7b11f45d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 16 Sep 2016 17:34:48 +0200 Subject: [PATCH] decoder/DecoderAPI: catch InputStream::Read() exceptions --- src/decoder/DecoderAPI.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx index aaba8fd37..2dda85063 100644 --- a/src/decoder/DecoderAPI.cxx +++ b/src/decoder/DecoderAPI.cxx @@ -311,7 +311,7 @@ size_t decoder_read(Decoder *decoder, InputStream &is, void *buffer, size_t length) -{ +try { /* XXX don't allow decoder==nullptr */ assert(decoder == nullptr || @@ -345,6 +345,9 @@ decoder_read(Decoder *decoder, LogError(error); return nbytes; +} catch (const std::runtime_error &e) { + LogError(e); + return 0; } bool