From 07c9cf89509350b1c0bff79af78acbba1c179328 Mon Sep 17 00:00:00 2001 From: "Gilbert J. M. Forkel" Date: Sun, 6 Dec 2015 18:32:52 +0100 Subject: [PATCH] Correctly detect a device without any dives. If the dive computer has not recorded any dives yet, the profile pointer isn't valid and contains the default value 0xFFFFFFFF. There is no need to return an error in this case. --- src/mares_iconhd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 93b2dfc..02a13ad 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -478,6 +478,8 @@ mares_iconhd_extract_dives (dc_device_t *abstract, const unsigned char data[], u break; } if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) { + if (eop == 0xFFFFFFFF) + return DC_STATUS_SUCCESS; // No dives available. ERROR (context, "Ringbuffer pointer out of range (0x%08x).", eop); return DC_STATUS_DATAFORMAT; }