Ensure sampleBuffer is valid before trying to copy data (#151).

This commit is contained in:
casey langen 2017-08-23 22:04:42 -07:00
parent c463732f56
commit e38e8d2ea7

View File

@ -216,7 +216,7 @@ bool M4aDecoder::GetBuffer(IBuffer* target) {
free(encodedData);
if (frameInfo.error <= 0 && decoderSampleId <= this->totalSamples) {
if (sampleBuffer && frameInfo.error <= 0 && decoderSampleId <= this->totalSamples) {
target->SetSampleRate(frameInfo.samplerate);
target->SetChannels(frameInfo.channels);
target->SetSamples(frameInfo.samples);