mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Always explicitly check for divide by zero conditions.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@335132 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
@ -190,9 +190,9 @@ void MPEG::Properties::read()
|
||||
static const int blockSize[] = { 0, 384, 1152, 1152 };
|
||||
|
||||
double timePerFrame = blockSize[firstHeader.layer()];
|
||||
timePerFrame = timePerFrame / firstHeader.sampleRate();
|
||||
timePerFrame = firstHeader.sampleRate() > 0 ? timePerFrame / firstHeader.sampleRate() : 0;
|
||||
d->length = int(timePerFrame * xingHeader.totalFrames());
|
||||
d->bitrate = d->length == 0 ? 0 : xingHeader.totalSize() * 8 / d->length / 1000;
|
||||
d->bitrate = d->length > 0 ? xingHeader.totalSize() * 8 / d->length / 1000 : 0;
|
||||
}
|
||||
|
||||
// Since there was no valid Xing header found, we hope that we're in a constant
|
||||
|
Reference in New Issue
Block a user