From a978dfbf5a511292c774b21b84fb8fcbc382ccdd Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sat, 26 Feb 2022 04:26:12 -0800 Subject: [PATCH] MAD Decoder: Fix MP3 decoding crash There was a stupid bug in the previous commit I made, which caused local or seekable MP3 files to crash the player on decode. This fixes that, by checking that a packet has actually been decoded before touching the packet info structures. Dumb, dumb, dumb error on my part. Fixes #244 Signed-off-by: Christopher Snowhill --- Plugins/MAD/MADDecoder.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/MAD/MADDecoder.m b/Plugins/MAD/MADDecoder.m index 1efb4c1b4..7866d3ef9 100644 --- a/Plugins/MAD/MADDecoder.m +++ b/Plugins/MAD/MADDecoder.m @@ -622,7 +622,8 @@ - (int)readAudio:(void *)buffer frames:(UInt32)frames { int framesRead = 0; - [self syncFormat:YES]; + if(!_firstFrame) + [self syncFormat:YES]; for(;;) { long framesRemaining = frames - framesRead;