Commit 3bc054cd authored by Mathias Carlen's avatar Mathias Carlen Committed by Commit Bot

[Direct Action] Fix null tab case.

This patch fixes a NPE by guarding for null tabs. There are situations
where a tab is not ready or available and direct action availability
is queried. In that case a null tab would crash instead of reporting
that this direct action is simply not yet available.

Bug: 1041669
Change-Id: Idda1c166405c726cca416898fcd842606e74d3cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2016625Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Commit-Queue: Mathias Carlen <mcarlen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735348}
parent 13e92ec3
......@@ -56,6 +56,6 @@ public class FindInPageDirectActionHandler implements DirectActionHandler {
/** Returns {@code true} if the action is currently available. */
private final boolean isAvailable() {
Tab tab = mTabModelSelector.getCurrentTab();
return !tab.isNativePage() && tab.getWebContents() != null;
return tab != null && !tab.isNativePage() && tab.getWebContents() != null;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment