mirror of
https://github.com/taglib/taglib.git
synced 2025-07-17 20:44:20 -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:
@ -133,8 +133,8 @@ void MPC::Properties::read()
|
||||
}
|
||||
|
||||
unsigned int samples = frames * 1152 - 576;
|
||||
d->length = (samples + (d->sampleRate / 2)) / d->sampleRate;
|
||||
d->length = d->sampleRate > 0 ? (samples + (d->sampleRate / 2)) / d->sampleRate : 0;
|
||||
|
||||
if(!d->bitrate)
|
||||
d->bitrate = ((d->streamLength * 8L) / d->length) / 1000;
|
||||
d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user