mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
core: properly clear pressure data of invalid sensors
When we found an invalid sensor (referring to a non existing cylinder) in fixup_dive() the sensor-id was set to NO_SENSOR. This led to invalid XML files, because the code decides to switch into legacy mode. However, there are two pressure readings, which is invalid in legacy mode. Therefore, also clear the pressure data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f50585a906
commit
d9c77a27da
1 changed files with 3 additions and 1 deletions
|
@ -1213,8 +1213,10 @@ static void fixup_dc_sample_sensors(struct divecomputer *dc, int nr_cylinders)
|
|||
for (int i = 0; i < dc->samples; i++) {
|
||||
struct sample *s = dc->sample + i;
|
||||
for (int j = 0; j < MAX_SENSORS; j++) {
|
||||
if (s->sensor[j] < 0 || s->sensor[j] >= nr_cylinders)
|
||||
if (s->sensor[j] < 0 || s->sensor[j] >= nr_cylinders) {
|
||||
s->sensor[j] = NO_SENSOR;
|
||||
s->pressure[j].mbar = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue