summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-06 07:38:18 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-06 07:39:19 -0700
commit74e7b8e87971cdc1675a4c98a1c293b36b8cc66d (patch)
treefed7802184e8bd9929a0fe47930bee0741322324 /qt-ui/models.cpp
parenteb63ccfed58d7a9f391bd5032e576707d4a58b58 (diff)
downloadsubsurface-74e7b8e87971cdc1675a4c98a1c293b36b8cc66d.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp11
1 files changed, 7 insertions, 4 deletions
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