Don't crash when wav files have a 0 for bit per channel (sampleWidth)

I've seen this in a wav that has an audio format of MP3 (0x55)
This commit is contained in:
Stephen F. Booth 2011-07-28 08:36:14 -04:00 committed by Lukáš Lalinský
parent b7ec0d26ab
commit 294cb22241

View File

@ -149,5 +149,5 @@ void RIFF::AIFF::Properties::read(const ByteVector &data)
double sampleRate = ConvertFromIeeeExtended(reinterpret_cast<unsigned char *>(data.mid(8, 10).data()));
d->sampleRate = sampleRate;
d->bitrate = (sampleRate * d->sampleWidth * d->channels) / 1000.0;
d->length = sampleFrames / d->sampleRate;
d->length = d->sampleRate > 0 ? sampleFrames / d->sampleRate : 0;
}