Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: chrome/browser/extensions/api/usb/usb_api.cc

Issue 23475048: Fixes crashing in RequestUsbDevicesAccess (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/usb/usb_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/usb/usb_api.cc
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc
index 2d3e8d80078631f8ec0b09dfc3b32481d110d79d..c17754e709bbb2941adb27e51b02a7f757e3c5a1 100644
--- a/chrome/browser/extensions/api/usb/usb_api.cc
+++ b/chrome/browser/extensions/api/usb/usb_api.cc
@@ -325,6 +325,10 @@ void RequestUsbDevicesAccess(
ScopedDeviceVector devices,
int interface_id,
const base::Callback<void(ScopedDeviceVector result)>& callback) {
+ if (devices->empty()) {
+ callback.Run(devices.Pass());
+ return;
+ }
(*devices->begin())->RequestUsbAcess(
interface_id,
base::Bind(RequestUsbDevicesAccessHelper, base::Passed(devices.Pass()),
« no previous file with comments | « no previous file | chrome/browser/usb/usb_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698