diff --git a/src/decoder/plugins/Mpg123DecoderPlugin.cxx b/src/decoder/plugins/Mpg123DecoderPlugin.cxx index a3f7d895f..bcce84b04 100644 --- a/src/decoder/plugins/Mpg123DecoderPlugin.cxx +++ b/src/decoder/plugins/Mpg123DecoderPlugin.cxx @@ -248,6 +248,8 @@ static SignedSongTime GetDuration(mpg123_handle &handle, const AudioFormat &audio_format) noexcept { const off_t num_samples = mpg123_length(&handle); + if (num_samples < 0) + return SignedSongTime::Negative(); return SongTime::FromScale(num_samples, audio_format.sample_rate);