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

Unified Diff: ash/virtual_keyboard_controller.cc

Issue 703703004: Fix infinite loop causing iterator to go out of bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Const Created 6 years, 1 month 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 | ash/virtual_keyboard_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/virtual_keyboard_controller.cc
diff --git a/ash/virtual_keyboard_controller.cc b/ash/virtual_keyboard_controller.cc
index 5c54f46960871a350db5577309109df5a938f7cf..18050cb1b43e1a48d41dad40ea924eac902193dd 100644
--- a/ash/virtual_keyboard_controller.cc
+++ b/ash/virtual_keyboard_controller.cc
@@ -72,13 +72,11 @@ void VirtualKeyboardController::UpdateDevices() {
// Checks for keyboards.
has_external_keyboard_ = false;
has_internal_keyboard_ = false;
- std::vector<ui::KeyboardDevice> keyboards =
- device_data_manager->keyboard_devices();
- for (auto iter = keyboards.begin();
- iter != keyboards.end() ||
- (has_internal_keyboard_ && has_external_keyboard_);
- ++iter) {
- ui::InputDeviceType type = (*iter).type;
+ for (const ui::KeyboardDevice& device :
+ device_data_manager->keyboard_devices()) {
+ if (has_internal_keyboard_ && has_external_keyboard_)
+ break;
+ ui::InputDeviceType type = device.type;
if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL)
has_internal_keyboard_ = true;
if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
« no previous file with comments | « no previous file | ash/virtual_keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698