Permalink
Browse files

Make sure to not try dividing by zero

  • Loading branch information...
1 parent cdfb447 commit 77d61c6eca4d08b9b025738acf6b926cc750db23 @lalinsky lalinsky committed Mar 4, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 taglib/ape/apeproperties.cpp
@@ -193,7 +193,7 @@ void APE::Properties::analyzeCurrent()
uint blocksPerFrame = header.mid(4, 4).toUInt(false);
uint finalFrameBlocks = header.mid(8, 4).toUInt(false);
uint totalBlocks = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0;
- d->length = totalBlocks / d->sampleRate;
+ d->length = d->sampleRate > 0 ? totalBlocks / d->sampleRate : 0;
d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
}

0 comments on commit 77d61c6

Please sign in to comment.