Commit be86e8ab authored by estade's avatar estade Committed by Commit bot

Fix crash when pressing stylus tools accelerator with null PaletteTray.

BUG=717422

Review-Url: https://codereview.chromium.org/2858583002
Cr-Commit-Position: refs/heads/master@{#468651}
parent 2d76b52e
......@@ -508,18 +508,22 @@ void HandleLock() {
void HandleShowStylusTools() {
base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
RootWindowController* root_window_controller =
Shell::GetWmRootWindowForNewWindows()->GetRootWindowController();
StatusAreaWidget* status_area_widget =
root_window_controller->GetShelf()->GetStatusAreaWidget();
// Tests (clusterfuzz) can trigger this before the status area is ready.
if (status_area_widget)
status_area_widget->palette_tray()->ShowPalette();
Shell::GetWmRootWindowForNewWindows()
->GetRootWindowController()
->GetShelf()
->GetStatusAreaWidget()
->palette_tray()
->ShowPalette();
}
bool CanHandleShowStylusTools() {
return Shell::Get()->palette_delegate() &&
StatusAreaWidget* status_area_widget = Shell::GetWmRootWindowForNewWindows()
->GetRootWindowController()
->GetShelf()
->GetStatusAreaWidget();
// Tests (clusterfuzz) can trigger this before the status area is ready.
return status_area_widget && status_area_widget->palette_tray() &&
Shell::Get()->palette_delegate() &&
Shell::Get()->palette_delegate()->ShouldShowPalette();
}
......
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