diff options
author | tdanderson <tdanderson@chromium.org> | 2014-12-11 14:52:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-11 22:52:51 +0000 |
commit | e59a6e0f1513a92ceaf4725171cee420214b2c3b (patch) | |
tree | e0a32827dee07319cc194e4498122025b41ffb32 /ui/events/gestures | |
parent | 141c63a1130432c29e0c3de186eeaff9bd9997c1 (diff) | |
download | chromium_src-e59a6e0f1513a92ceaf4725171cee420214b2c3b.zip chromium_src-e59a6e0f1513a92ceaf4725171cee420214b2c3b.tar.gz chromium_src-e59a6e0f1513a92ceaf4725171cee420214b2c3b.tar.bz2 |
The GestureRecognizer should never map an ID to a NULL consumer
The current implementation of
GestureRecognizerImpl::GetTargetForGestureEvent() will insert a
mapping between a touch ID and a NULL GestureConsumer to
|touch_id_target_for_gestures_| if queried with a touch ID that
does not already exist in the map. Use .at() instead of []
to avoid this possibility.
BUG=403346
TEST=none
Review URL: https://codereview.chromium.org/466323004
Cr-Commit-Position: refs/heads/master@{#307986}
Diffstat (limited to 'ui/events/gestures')
-rw-r--r-- | ui/events/gestures/gesture_recognizer_impl.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/events/gestures/gesture_recognizer_impl.cc b/ui/events/gestures/gesture_recognizer_impl.cc index 950bec9..acd9643 100644 --- a/ui/events/gestures/gesture_recognizer_impl.cc +++ b/ui/events/gestures/gesture_recognizer_impl.cc @@ -83,10 +83,13 @@ GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget( GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent( const GestureEvent& event) { - GestureConsumer* target = NULL; int touch_id = event.details().oldest_touch_id(); - target = touch_id_target_for_gestures_[touch_id]; - return target; + if (!touch_id_target_for_gestures_.count(touch_id)) { + NOTREACHED() << "Touch ID does not map to a valid GestureConsumer."; + return nullptr; + } + + return touch_id_target_for_gestures_.at(touch_id); } GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( |