Skip to content

Commit 51183d0

Browse files
daschuerCopilot
andcommitted
Fix check for a valid usb interface number.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 556afe9 commit 51183d0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/controllers/hid/hidenumerator.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ namespace {
4141
bool recognizeDevice(const mixxx::hid::DeviceInfo& deviceInfo) {
4242
const unsigned short vendor_id = deviceInfo.getVendorId();
4343
const unsigned short product_id = deviceInfo.getProductId();
44-
const int interface_number = deviceInfo.getUsbInterfaceNumber().value_or(
45-
kInvalidInterfaceNumber);
44+
const auto usbInterfaceNumber = deviceInfo.getUsbInterfaceNumber();
45+
const int interface_number = usbInterfaceNumber.has_value()
46+
? static_cast<int>(*usbInterfaceNumber)
47+
: kInvalidInterfaceNumber;
4648
// On Android, usage_page and usage are only accessible when permission is
4749
// granted to the device, so we don't use it for device detection.
4850
#ifndef __ANDROID__

0 commit comments

Comments
 (0)