aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'subsurface-core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.cpp14
1 files changed, 6 insertions, 8 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