Adding a null check to ToolbarLayout#shouldIgnoreSwipeGesture()

While refactoring the MenuButton class a null check was omitted in
ToolbarLayout#shouldIgnoreSwipeGesture() this led to the linked bug.
This CL adds the needed null check.

Bug: 925754
Change-Id: Id274e830bb6852e84d09fc846a749c6c1cf26462
Reviewed-on: https://chromium-review.googlesource.com/c/1439943
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Pedro Amaral <amaralp@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#626605}(cherry picked from commit e7c324e94abb7f143b3464e8eb8a0b97de4621af)
Reviewed-on: https://chromium-review.googlesource.com/c/1445901
Reviewed-by: Ben Mason <benmason@chromium.org>
Cr-Commit-Position: refs/branch-heads/3683@{#92}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarLayout.java
index 46db4a3..469013b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarLayout.java
@@ -600,10 +600,10 @@
     void setTextureCaptureMode(boolean textureMode) {}
 
     boolean shouldIgnoreSwipeGesture() {
+        if (mUrlHasFocus || mFindInPageToolbarShowing) return true;
+        if (mMenuButtonWrapper == null) return false;
         final AppMenuButtonHelper appMenuButtonHelper = mMenuButtonWrapper.getAppMenuButtonHelper();
-        return mUrlHasFocus
-                || (appMenuButtonHelper != null && appMenuButtonHelper.isAppMenuActive())
-                || mFindInPageToolbarShowing;
+        return appMenuButtonHelper != null && appMenuButtonHelper.isAppMenuActive();
     }
 
     /**