From 6036df047f1793ea8262166cca5a8272307aa1de Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Sat, 12 Oct 2024 18:03:19 -0400 Subject: [PATCH] views: cefclient: Fix crash when ID_MENU_BUTTON doesn't exist --- tests/cefclient/browser/views_window.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cefclient/browser/views_window.cc b/tests/cefclient/browser/views_window.cc index 43668716a..9449cd0ad 100644 --- a/tests/cefclient/browser/views_window.cc +++ b/tests/cefclient/browser/views_window.cc @@ -1350,12 +1350,12 @@ void ViewsWindow::SetMenuFocusable(bool focusable) { if (menu_bar_) { menu_bar_->SetMenuFocusable(focusable); - } else { - window_->GetViewForID(ID_MENU_BUTTON)->SetFocusable(focusable); + } else if (menu_button_) { + menu_button_->SetFocusable(focusable); if (focusable) { // Give focus to menu button. - window_->GetViewForID(ID_MENU_BUTTON)->RequestFocus(); + menu_button_->RequestFocus(); } }