diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-11 07:15:40 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-11 07:15:40 -0700 |
commit | 6ab95af9ac718874e8d2c0ed0b1381627ca59443 (patch) | |
tree | 0a453ce1b861e4ed6a1a4ee908e5945c1cd0c983 /libdivecomputer.c | |
parent | 692ad31ad397803a4d222823549f8a8de2dd88d9 (diff) | |
download | subsurface-6ab95af9ac718874e8d2c0ed0b1381627ca59443.tar.gz |
Don't silently ignore suspcious data from libdivecomputer
Otherwise possible bugs in libdivecomputer won't get reported and fixed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |