From eb0ccace773555c328bee98c78c43ed104d54481 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 6 Dec 2015 13:38:38 -0800 Subject: 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 --- subsurface-core/uemis-downloader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'subsurface-core') diff --git a/subsurface-core/uemis-downloader.c b/subsurface-core/uemis-downloader.c index 8e7f9f60a..6f5c5f177 100644 --- a/subsurface-core/uemis-downloader.c +++ b/subsurface-core/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 { -- cgit v1.2.3-70-g09d2