From 6c62cfb1aa248d9106f5a70ecf690dd320028365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 26 Mar 2017 12:20:41 +0200 Subject: [PATCH] IOS/BTReal: Properly check for libusb failures --- Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 6326bd447f..14fd8868da 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -87,7 +87,13 @@ ReturnCode BluetoothReal::Open(const OpenRequest& request) libusb_device** list; const ssize_t cnt = libusb_get_device_list(m_libusb_context.get(), &list); - _dbg_assert_msg_(IOS, cnt > 0, "Couldn't get device list"); + if (cnt < 0) + { + ERROR_LOG(IOS_WIIMOTE, "Couldn't get device list: %s", + libusb_error_name(static_cast(cnt))); + return IPC_ENOENT; + } + for (ssize_t i = 0; i < cnt; ++i) { libusb_device* device = list[i];