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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-12-06 13:38:38 -08:00
parent 491ef7edc8
commit eb0ccace77

View file

@ -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 {