From 74e7b8e87971cdc1675a4c98a1c293b36b8cc66d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 6 Aug 2014 07:38:18 -0700 Subject: Don't show a SAC of 0.0l/min (or cuft/min) When we have no data about the gas consumption it makes no sense to show a SAC of 0. Instead we should show either "unknown" or nothing. Fixes #693 Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'qt-ui/models.cpp') diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 213a13d5f..11e84c9c2 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -1263,10 +1263,13 @@ QString DiveItem::displaySac() const { QString str; struct dive *dive = get_dive_by_uniq_id(diveId); - const char *unit; - int decimal; - double value = get_volume_units(dive->sac, &decimal, &unit); - return QString::number(value, 'f', decimal).append(unit).append(tr("/min")); + if (dive->sac) { + const char *unit; + int decimal; + double value = get_volume_units(dive->sac, &decimal, &unit); + return QString::number(value, 'f', decimal).append(unit).append(tr("/min")); + } + return QString(""); } QString DiveItem::displayWeight() const -- cgit v1.2.3-70-g09d2