bluetooth: Fix crash in pa_bluetooth_discovery_get_device_by_address()

We need to check if the device information is valid first, so we don't
pass invalid strings to pa_streq().
This commit is contained in:
João Paulo Rechi Vita 2013-11-20 18:21:36 -03:00 committed by Tanu Kaskinen
parent d8fb09b567
commit b705e38a79

View file

@ -395,8 +395,8 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_address(pa_bluetooth_d
pa_assert(local); pa_assert(local);
while ((d = pa_hashmap_iterate(y->devices, &state, NULL))) while ((d = pa_hashmap_iterate(y->devices, &state, NULL)))
if (pa_streq(d->address, remote) && pa_streq(d->adapter->address, local)) if (d->device_info_valid == 1 && pa_streq(d->address, remote) && pa_streq(d->adapter->address, local))
return d->device_info_valid == 1 ? d : NULL; return d;
return NULL; return NULL;
} }