Commit 73fa844f authored by bttk's avatar bttk Committed by Commit Bot

Check for null in LocationBarCoordinator.getVoiceRecognitionHandler()

Prevent NullPointerException after destroy() was called.

Bug: 1140333
Fixed: 1139100
Change-Id: I3a8cd6117bf9a01e8c43d98d44798db59da9f0b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2481289
Commit-Queue: Theresa  <twellington@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarBrandon Wylie <wylieb@chromium.org>
Auto-Submit: who/bttk <bttk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819110}
parent da21dc00
......@@ -872,6 +872,7 @@ public class CustomTabToolbar extends ToolbarLayout implements View.OnLongClickL
return false;
}
@Nullable
@Override
public VoiceRecognitionHandler getVoiceRecognitionHandler() {
return null;
......
......@@ -47,10 +47,8 @@ public interface FakeboxDelegate {
*/
boolean isCurrentPage(NativePage nativePage);
/**
* Get the {@link VoiceRecognitionHandler}.
* @return the {@link VoiceRecognitionHandler}
*/
/** Gets the {@link VoiceRecognitionHandler}. */
@Nullable
VoiceRecognitionHandler getVoiceRecognitionHandler();
/**
......
......@@ -25,7 +25,7 @@ public interface LocationBar extends UrlBarDelegate, FakeboxDelegate, Destroyabl
void onNativeLibraryReady();
/** Triggered when the current tab has changed to a {@link NewTabPage}. */
default void onTabLoadingNTP(NewTabPage ntp){};
default void onTabLoadingNTP(NewTabPage ntp) {}
/**
* Call to force the UI to update the state of various buttons based on whether or not the
......
......@@ -240,8 +240,13 @@ public final class LocationBarCoordinator implements LocationBar {
return mLocationBarLayout.isCurrentPage(nativePage);
}
@Nullable
@Override
public VoiceRecognitionHandler getVoiceRecognitionHandler() {
// TODO(crbug.com/1140333): StartSurfaceMediator can call this method after destroy().
if (mLocationBarLayout == null) {
return null;
}
return mLocationBarLayout.getVoiceRecognitionHandler();
}
......
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