Skip to content

Commit

Permalink
Fix for bug that crashes when operations are done on an empty map
Browse files Browse the repository at this point in the history
This is a temporary fix for a crash that is caused when an operation
is performed on a map in inconsistent state.

This fix adds an empty check before these operations are called,
preventing the bug from occurring but does not cure the root cause of
the problem.

Bug: 732232
Change-Id: Iae139ecbc441095ba4c2176bccf3a3b20faeb068
Component: Touch, GestureRecognizer, Events
Reviewed-on: https://chromium-review.googlesource.com/675834
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503646}
  • Loading branch information
F#m authored and Commit Bot committed Sep 22, 2017
1 parent 66dbc95 commit bc985e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ui/events/gestures/gesture_recognizer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void TransferConsumer(
template <class Key, class T, class Value>
bool RemoveValueFromMap(std::map<Key, T>* map, const Value& value) {
bool removed = false;
// This is a bandaid fix for crbug/732232 that requires further investigation.
if (!map || map->empty())
return removed;
for (auto i = map->begin(); i != map->end();) {
if (i->second == value) {
map->erase(i++);
Expand Down

0 comments on commit bc985e7

Please sign in to comment.