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

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: 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..0c1637a7ee2213ed778e2f7ef16c83b92fbe8958 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->begin() == devices->end()) {
xiyuan 2013/09/14 00:37:31 nit: Can we use devices->empty()? It is more reada
Bei Zhang 2013/09/14 06:05:58 Done.
+ 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