bluetooth: Always initialize profile->available

If the transport for the profile doesn't exist, the old behaviour was
to leave cp->available at the default value, which is
PA_AVAILABLE_UNKNOWN, but if there's no transport, the profile should
be marked as unavailable.
This commit is contained in:
Tanu Kaskinen 2014-08-11 12:47:46 +03:00
parent b1c4e7bf6b
commit 638d0a51e2

View file

@ -1755,8 +1755,12 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
*p = PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY; *p = PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY;
} }
if (cp && u->device->transports[*p]) if (cp) {
cp->available = transport_state_to_availability(u->device->transports[*p]->state); if (u->device->transports[*p])
cp->available = transport_state_to_availability(u->device->transports[*p]->state);
else
cp->available = PA_AVAILABLE_NO;
}
return cp; return cp;
} }