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 ...@@ -872,6 +872,7 @@ public class CustomTabToolbar extends ToolbarLayout implements View.OnLongClickL
return false; return false;
} }
@Nullable
@Override @Override
public VoiceRecognitionHandler getVoiceRecognitionHandler() { public VoiceRecognitionHandler getVoiceRecognitionHandler() {
return null; return null;
......
...@@ -47,10 +47,8 @@ public interface FakeboxDelegate { ...@@ -47,10 +47,8 @@ public interface FakeboxDelegate {
*/ */
boolean isCurrentPage(NativePage nativePage); boolean isCurrentPage(NativePage nativePage);
/** /** Gets the {@link VoiceRecognitionHandler}. */
* Get the {@link VoiceRecognitionHandler}. @Nullable
* @return the {@link VoiceRecognitionHandler}
*/
VoiceRecognitionHandler getVoiceRecognitionHandler(); VoiceRecognitionHandler getVoiceRecognitionHandler();
/** /**
......
...@@ -25,7 +25,7 @@ public interface LocationBar extends UrlBarDelegate, FakeboxDelegate, Destroyabl ...@@ -25,7 +25,7 @@ public interface LocationBar extends UrlBarDelegate, FakeboxDelegate, Destroyabl
void onNativeLibraryReady(); void onNativeLibraryReady();
/** Triggered when the current tab has changed to a {@link NewTabPage}. */ /** 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 * 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 { ...@@ -240,8 +240,13 @@ public final class LocationBarCoordinator implements LocationBar {
return mLocationBarLayout.isCurrentPage(nativePage); return mLocationBarLayout.isCurrentPage(nativePage);
} }
@Nullable
@Override @Override
public VoiceRecognitionHandler getVoiceRecognitionHandler() { public VoiceRecognitionHandler getVoiceRecognitionHandler() {
// TODO(crbug.com/1140333): StartSurfaceMediator can call this method after destroy().
if (mLocationBarLayout == null) {
return null;
}
return mLocationBarLayout.getVoiceRecognitionHandler(); 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