aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveInformation.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-04 19:49:43 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-09 19:19:04 +0100
commit6a1e2cd8c23df47833db55856c5e27c2e198aa6e (patch)
treec7fb8759e550d128f6826e5a014d730b990c7d07 /desktop-widgets/tab-widgets/TabDiveInformation.cpp
parentfd23c3d9085a4cd288b95ea414f58f3ad1ac92f1 (diff)
downloadsubsurface-6a1e2cd8c23df47833db55856c5e27c2e198aa6e.tar.gz
Desktop: support no-cylinders in dive information tab
The tab was crashing if there were no cylinders because 1) per_cylinder_mean_depth() would access non-existing cylinders. 2) TabDiveInformation::updateProfile() would access a non-existing mean. Fix both of these crash conditions by checking whether the dive actually has cylinders. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveInformation.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveInformation.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
index afa427bdc..6fabc3bb3 100644
--- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
@@ -82,7 +82,7 @@ void TabDiveInformation::updateProfile()
ui->diveTimeText->setText(get_dive_duration_string(current_dive->duration.seconds, tr("h"), tr("min"), tr("sec"),
" ", current_dive->dc.divemode == FREEDIVE));
- ui->sacText->setText( mean[0] ? SACs : QString());
+ ui->sacText->setText(current_dive->cylinders.nr > 0 && mean[0] ? SACs : QString());
if (current_dive->surface_pressure.mbar == 0) {
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box