Only warn about different number of tanks and gases if there are tanks

Some backends support giving tank data for some, but not all models that
they support (and simply report no tanks for those models that don't
support this). The Suunto Vyper is one of the dive computers where this
happens and without this change we report angry red warnings after a
perfectly correct download.

So this changes the logic to only show that error if there actually were
tanks reported.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-12-06 09:40:21 -08:00
parent b5fcfc8867
commit 956d189734

View file

@ -77,7 +77,7 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
int ntanks = 0;
rc = dc_parser_get_field(parser, DC_FIELD_TANK_COUNT, 0, &ntanks);
if (rc == DC_STATUS_SUCCESS) {
if (ntanks != ngases) {
if (ntanks && ntanks != ngases) {
shown_warning = true;
report_error("different number of gases (%d) and tanks (%d)", ngases, ntanks);
}