mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
692ad31ad3
commit
6ab95af9ac
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue