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

Unified Diff: chrome/browser/media_gallery/media_storage_util.cc

Issue 10869067: Deliver attach intent to packaged apps (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment Created 8 years, 4 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
Index: chrome/browser/media_gallery/media_storage_util.cc
diff --git a/chrome/browser/media_gallery/media_storage_util.cc b/chrome/browser/media_gallery/media_storage_util.cc
index d41f13c508e3f5561c93e06c4a4c8962447cf971..2051bf358f08b6476451929677ebe35a802c19c1 100644
--- a/chrome/browser/media_gallery/media_storage_util.cc
+++ b/chrome/browser/media_gallery/media_storage_util.cc
@@ -101,8 +101,13 @@ std::string MediaStorageUtil::MakeDeviceId(Type type,
// static
bool MediaStorageUtil::CrackDeviceId(const std::string& device_id,
Type* type, std::string* unique_id) {
+ // The device ID is always generated by MakeDeviceId, so we should always
+ // be able to find a valid prefix delimited by ':'.
size_t prefix_length = device_id.find_first_of(':');
- std::string prefix = device_id.substr(0, prefix_length);
+ std::string prefix;
+ if (prefix_length != std::string::npos) {
benwells 2012/08/29 00:00:14 Nit: This should be a DCHECK then. It will be more
thorogood 2012/08/29 00:16:35 Done.
+ prefix = device_id.substr(0, prefix_length + 1);
+ }
Type found_type;
if (prefix == kUsbMassStorageWithDCIMPrefix) {
« no previous file with comments | « chrome/browser/extensions/platform_app_launcher.cc ('k') | chrome/browser/media_gallery/media_storage_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698