From f2a3dfd700a7d19bc39509dce226262347dd7f9b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Apr 2022 20:51:49 +0200 Subject: [PATCH] decoder/ffmpeg: add missing nullptr checks Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1490 --- src/decoder/plugins/FfmpegDecoderPlugin.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index b7b4bc93d..f9915554a 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -384,7 +384,8 @@ static void FfmpegParseMetaData(const AVStream &stream, ReplayGainInfo &rg, MixRampInfo &mr) { - FfmpegParseMetaData(*stream.metadata, rg, mr); + if (stream.metadata != nullptr) + FfmpegParseMetaData(*stream.metadata, rg, mr); } static void @@ -393,7 +394,9 @@ FfmpegParseMetaData(const AVFormatContext &format_context, int audio_stream, { assert(audio_stream >= 0); - FfmpegParseMetaData(*format_context.metadata, rg, mr); + if (format_context.metadata != nullptr) + FfmpegParseMetaData(*format_context.metadata, rg, mr); + FfmpegParseMetaData(*format_context.streams[audio_stream], rg, mr); }