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

Unified Diff: ui/events/gesture_detection/gesture_detector.cc

Issue 2595943003: Null check secondary_pointer_down_event_ (Closed)
Patch Set: Created 4 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_detection/gesture_detector.cc
diff --git a/ui/events/gesture_detection/gesture_detector.cc b/ui/events/gesture_detection/gesture_detector.cc
index 1d26d730d28a7f7a04ea1c8cbd4c56d1b5db9e2e..ef0e71f6d5dcd14368a65ebbfceae64f6e354728 100644
--- a/ui/events/gesture_detection/gesture_detector.cc
+++ b/ui/events/gesture_detection/gesture_detector.cc
@@ -311,8 +311,9 @@ bool GestureDetector::OnTouchEvent(const MotionEvent& ev) {
if (!IsWithinTouchSlop(ev)) {
handled = listener_->OnScroll(
*current_down_event_, ev,
- (maximum_pointer_count_ > 1 ? *secondary_pointer_down_event_
- : ev),
+ (maximum_pointer_count_ > 1 && secondary_pointer_down_event_)
+ ? *secondary_pointer_down_event_
+ : ev,
scroll_x, scroll_y);
last_focus_x_ = focus_x;
last_focus_y_ = focus_y;
@@ -329,8 +330,9 @@ bool GestureDetector::OnTouchEvent(const MotionEvent& ev) {
std::abs(scroll_y) > kScrollEpsilon) {
handled = listener_->OnScroll(
*current_down_event_, ev,
- (maximum_pointer_count_ > 1 ? *secondary_pointer_down_event_
- : ev),
+ (maximum_pointer_count_ > 1 && secondary_pointer_down_event_)
+ ? *secondary_pointer_down_event_
+ : ev,
scroll_x, scroll_y);
last_focus_x_ = focus_x;
last_focus_y_ = focus_y;
@@ -553,8 +555,9 @@ bool GestureDetector::IsWithinTouchSlop(const MotionEvent& ev) {
const int pointer_id = ev.GetPointerId(i);
const MotionEvent* source_pointer_down_event = GetSourcePointerDownEvent(
*current_down_event_,
- maximum_pointer_count_ > 1 ? *secondary_pointer_down_event_
- : *current_down_event_,
+ (maximum_pointer_count_ > 1 && secondary_pointer_down_event_)
+ ? *secondary_pointer_down_event_
+ : *current_down_event_,
pointer_id);
DCHECK(source_pointer_down_event);
if (!source_pointer_down_event)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698