mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
divesummary: fix potential division by zero
[Dirk Hohndel: extracted from a larger commit from Jan] Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a65ec77263
commit
9452a78b1d
1 changed files with 7 additions and 2 deletions
|
@ -175,9 +175,14 @@ void diveSummary::buildStringList(int inx)
|
|||
unitText = (qPrefUnits::volume() == units::LITER) ? " l/min" : " cuft/min";
|
||||
diveSummaryText[18+inx] = volumeString(sacMin[inx]) + unitText;
|
||||
diveSummaryText[20+inx] = volumeString(sacMax[inx]) + unitText;
|
||||
|
||||
// finally the weighted average
|
||||
if (totalSACTime[inx]) {
|
||||
long avgSac = totalSacVolume[inx] / totalSACTime[inx];
|
||||
diveSummaryText[22+inx] = volumeString(avgSac) + unitText;
|
||||
} else {
|
||||
diveSummaryText[22+inx] = QObject::tr("no dives");
|
||||
}
|
||||
|
||||
// Diveplan(s)
|
||||
diveSummaryText[24+inx] = QStringLiteral("%1").arg(diveplans[inx]);
|
||||
|
|
Loading…
Reference in a new issue