Improve the handling of devices without any dives

Don't return an error if the dive computer reports there are no dives
available!
This commit is contained in:
Jef Driesen 2017-06-03 10:01:45 +02:00
parent 5178c0f755
commit 3b967f9eb1

View File

@ -437,8 +437,13 @@ divesystem_idive_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb
unsigned char cmd_range[] = {commands->range.cmd, 0x8D};
rc = divesystem_idive_transfer (device, cmd_range, sizeof(cmd_range), packet, commands->range.size, &errcode);
if (rc != DC_STATUS_SUCCESS)
return rc;
if (rc != DC_STATUS_SUCCESS) {
if (errcode == ERR_UNAVAILABLE) {
return DC_STATUS_SUCCESS; // No dives found.
} else {
return rc;
}
}
// Get the range of the available dive numbers.
unsigned int first = array_uint16_le (packet + 0);