Commit cc3b684f authored by twellington's avatar twellington Committed by Commit bot

[Home] Add more null checks for LayoutManagerChrome

The LayoutManagerChrome can still be null when #onNewTabPageShown()
is called for the first time.

BUG=699935

Review-Url: https://codereview.chromium.org/2741843003
Cr-Commit-Position: refs/heads/master@{#456137}
parent 6694c0e5
...@@ -188,7 +188,7 @@ public class ChromeHomeNewTabPage implements NativePage, TemplateUrlServiceObser ...@@ -188,7 +188,7 @@ public class ChromeHomeNewTabPage implements NativePage, TemplateUrlServiceObser
// OverviewModeBehavior, we have no good signal to show the BottomSheet when an NTP is // OverviewModeBehavior, we have no good signal to show the BottomSheet when an NTP is
// selected in the tab switcher. Eventually this won't matter because we will not allow // selected in the tab switcher. Eventually this won't matter because we will not allow
// NTPs to remain open after the user leaves them. // NTPs to remain open after the user leaves them.
if (getLayoutManager().overviewVisible()) return; if (getLayoutManager() != null && getLayoutManager().overviewVisible()) return;
mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_HALF, true); mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_HALF, true);
} }
...@@ -218,7 +218,9 @@ public class ChromeHomeNewTabPage implements NativePage, TemplateUrlServiceObser ...@@ -218,7 +218,9 @@ public class ChromeHomeNewTabPage implements NativePage, TemplateUrlServiceObser
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_PEEK, true); mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_PEEK, true);
if (mShowOverviewOnClose) getLayoutManager().showOverview(false); if (mShowOverviewOnClose && getLayoutManager() != null) {
getLayoutManager().showOverview(false);
}
// Close the tab after showing the overview mode so the bottom sheet doesn't open // Close the tab after showing the overview mode so the bottom sheet doesn't open
// if another NTP is selected when this one is closed. // if another NTP is selected when this one is closed.
......
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