From e1768b4771be6b2830f1c291a17cae859f80ec95 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 6 Dec 2015 13:38:38 -0800 Subject: [PATCH] Uemis downloader: handle yet another corner case If we looking for dive details and are trying to guess the offset between object_id and logfilenr, we need to treat logfilenr 0 as special - it means we read past the end of the list of stored dives and need to walk backwards. Signed-off-by: Dirk Hohndel --- uemis-downloader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uemis-downloader.c b/uemis-downloader.c index a9c462db1..9358bb8ee 100644 --- a/uemis-downloader.c +++ b/uemis-downloader.c @@ -1185,7 +1185,7 @@ static bool get_matching_dive(int idx, char *newmax, int *uemis_mem_status, stru char *logfilenr = strstr(mbuf, "logfilenr"); if (logfilenr) { sscanf(logfilenr, "logfilenr{int{%u", &nr_found); - if (nr_found >= dive->dc.diveid) { + if (nr_found >= dive->dc.diveid || nr_found == 0) { found_above = true; dive_to_read = dive_to_read - 2; } else {