summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/dive.c b/core/dive.c
index 7cad36154..5391f3df9 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -1423,6 +1423,19 @@ static void fixup_dc_depths(struct dive *dive, struct divecomputer *dc)
dive->maxdepth.mm = maxdepth;
}
+static void fixup_dc_ndl(struct dive *dive, struct divecomputer *dc)
+{
+ int i;
+
+ for (i = 0; i < dc->samples; i++) {
+ struct sample *sample = dc->sample + i;
+ if (sample->ndl.seconds != 0)
+ break;
+ if (sample->ndl.seconds == 0)
+ sample->ndl.seconds = -1;
+ }
+}
+
static void fixup_dc_temp(struct dive *dive, struct divecomputer *dc)
{
int i;
@@ -1640,6 +1653,9 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
/* Fix up sample depth data */
fixup_dc_depths(dive, dc);
+ /* Fix up first sample ndl data */
+ fixup_dc_ndl(dive, dc);
+
/* Fix up dive temperatures based on dive computer samples */
fixup_dc_temp(dive, dc);