From 77d61c6eca4d08b9b025738acf6b926cc750db23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Sun, 4 Mar 2012 11:51:05 +0100 Subject: [PATCH] Make sure to not try dividing by zero --- taglib/ape/apeproperties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taglib/ape/apeproperties.cpp b/taglib/ape/apeproperties.cpp index aab9d25c..4f14d6c5 100644 --- a/taglib/ape/apeproperties.cpp +++ b/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; } -- 2.40.0