Fix the return value for a NULL key

An example where the filter functions can be called with a NULL key is
when a bluetooth discovery fails to retrieve the name of the remote
device. In such case, we have no information to detect whether the
bluetooth device matches a known dive computer or not, and thus it
shouldn't be filtered out.
This commit is contained in:
Jef Driesen 2021-01-24 08:26:03 +01:00
parent b9a99de158
commit efc9236fbc

View File

@ -495,7 +495,7 @@ static int
dc_filter_internal (const void *key, const void *values, size_t count, size_t size, dc_match_t match, void *params_dst, const void *params_src, size_t params_size)
{
if (key == NULL)
return 0;
return 1;
for (size_t i = 0; i < count; ++i) {
if (match (key, (const unsigned char *) values + i * size)) {