Index: device/bluetooth/bluetooth_device.cc |
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc |
index 665cbb685a68da5afedd3e6cdd60dd8898597fff..1820fe464bc979ab177c332e8c06d2690639b2ee 100644 |
--- a/device/bluetooth/bluetooth_device.cc |
+++ b/device/bluetooth/bluetooth_device.cc |
@@ -490,12 +490,14 @@ BluetoothDevice::GetDescriptorsByUUID( |
device::BluetoothRemoteGattCharacteristic* characteristic, |
const BluetoothUUID& descriptor_uuid) { |
std::vector<device::BluetoothRemoteGattDescriptor*> descriptors; |
- DVLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); |
- for (auto* descriptor : characteristic->GetDescriptors()) { |
- DVLOG(1) << "Descriptor in cache: " |
- << descriptor->GetUUID().canonical_value(); |
- if (descriptor->GetUUID() == descriptor_uuid) { |
- descriptors.push_back(descriptor); |
+ if (characteristic) { |
+ DVLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); |
+ for (auto* descriptor : characteristic->GetDescriptors()) { |
+ DVLOG(1) << "Descriptor in cache: " |
+ << descriptor->GetUUID().canonical_value(); |
+ if (descriptor->GetUUID() == descriptor_uuid) { |
+ descriptors.push_back(descriptor); |
+ } |
} |
} |
return descriptors; |