aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.cpp14
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.h1
2 files changed, 6 insertions, 9 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
index a06e5bbcb..e39ba2fbb 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -58,13 +58,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) :
}
m_gas = gases;
- if (d->sac) {
- const char *unit;
- int decimal;
- double value = get_volume_units(d->sac, &decimal, &unit);
- m_sac = QString::number(value, 'f', decimal).append(unit);
- }
-
for (int i = 0; i < MAX_CYLINDERS; i++)
m_cylinders << getFormattedCylinder(d, i);
@@ -186,7 +179,12 @@ QString DiveObjectHelper::gas() const
QString DiveObjectHelper::sac() const
{
- return m_sac;
+ if (!m_dive->sac)
+ return QString();
+ const char *unit;
+ int decimal;
+ double value = get_volume_units(m_dive->sac, &decimal, &unit);
+ QString::number(value, 'f', decimal).append(unit);
}
QStringList DiveObjectHelper::weights() const
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h
index 587b3f692..c5fddbb3d 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.h
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h
@@ -66,7 +66,6 @@ private:
QString m_time;
QString m_tags;
QString m_gas;
- QString m_sac;
QStringList m_weights;
QStringList m_cylinders;
struct dive *m_dive;