From 6ab95af9ac718874e8d2c0ed0b1381627ca59443 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 11 Jun 2014 07:15:40 -0700 Subject: Don't silently ignore suspcious data from libdivecomputer Otherwise possible bugs in libdivecomputer won't get reported and fixed. Signed-off-by: Dirk Hohndel --- libdivecomputer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libdivecomputer.c') diff --git a/libdivecomputer.c b/libdivecomputer.c index 8add6fdf6..22df874fe 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -116,11 +116,14 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t he = rint(gasmix.helium * 1000); /* Ignore bogus data - libdivecomputer does some crazy stuff */ - if (o2 + he <= O2_IN_AIR || o2 > 1000) + if (o2 + he <= O2_IN_AIR || o2 > 1000) { + report_error("unlikely dive gas data from libdivecomputer: o2 = %d he = %d", o2, he); o2 = 0; - if (he < 0 || o2 + he > 1000) + } + if (he < 0 || o2 + he > 1000) { + report_error("unlikely dive gas data from libdivecomputer: o2 = %d he = %d", o2, he); he = 0; - + } dive->cylinder[i].gasmix.o2.permille = o2; dive->cylinder[i].gasmix.he.permille = he; -- cgit v1.2.3-70-g09d2