summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplannermodel.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 49fc50229..b5db3f07e 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -78,7 +78,12 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
// if yes then the first sample should be marked
// if it is we only add the manually entered samples as waypoints to the diveplan
// otherwise we have to add all of them
- bool hasMarkedSamples = d->dc.sample[0].manually_entered;
+
+ bool hasMarkedSamples = false;
+
+ if (d->dc.samples)
+ hasMarkedSamples = d->dc.sample[0].manually_entered;
+
// if this dive has more than 100 samples (so it is probably a logged dive),
// average samples so we end up with a total of 100 samples.
int plansamples = d->dc.samples <= 100 ? d->dc.samples : 100;