| Index: device/usb/usb_device_filter.cc
|
| diff --git a/device/usb/usb_device_filter.cc b/device/usb/usb_device_filter.cc
|
| index 2d3f157a1c29c61706f8e0b1136d086b5883ef4b..970bbd041b17c2dc05d1f39f3278dda50d09e8aa 100644
|
| --- a/device/usb/usb_device_filter.cc
|
| +++ b/device/usb/usb_device_filter.cc
|
| @@ -68,21 +68,22 @@ bool UsbDeviceFilter::Matches(scoped_refptr<UsbDevice> device) const {
|
| }
|
|
|
| if (interface_class_set_) {
|
| - bool foundMatch = false;
|
| - const UsbConfigDescriptor& config = device->GetConfiguration();
|
| + const UsbConfigDescriptor* config = device->GetConfiguration();
|
| + if (!config) {
|
| + return false;
|
| + }
|
|
|
| // TODO(reillyg): Check device configuration if the class is not defined at
|
| // a per-interface level. This is not really important because most devices
|
| // have per-interface classes. The only counter-examples I know of are hubs.
|
|
|
| - for (UsbInterfaceDescriptor::Iterator ifaceIt = config.interfaces.begin();
|
| - ifaceIt != config.interfaces.end() && !foundMatch;
|
| - ++ifaceIt) {
|
| - if (ifaceIt->interface_class == interface_class_ &&
|
| + bool foundMatch = false;
|
| + for (const UsbInterfaceDescriptor& iface : config->interfaces) {
|
| + if (iface.interface_class == interface_class_ &&
|
| (!interface_subclass_set_ ||
|
| - (ifaceIt->interface_subclass == interface_subclass_ &&
|
| + (iface.interface_subclass == interface_subclass_ &&
|
| (!interface_protocol_set_ ||
|
| - ifaceIt->interface_protocol == interface_protocol_)))) {
|
| + iface.interface_protocol == interface_protocol_)))) {
|
| foundMatch = true;
|
| }
|
| }
|
|
|