views: cefclient: Fix crash when ID_MENU_BUTTON doesn't exist

This commit is contained in:
Marshall Greenblatt 2024-10-12 18:03:19 -04:00
parent 0187046a2e
commit f1e634393f
1 changed files with 3 additions and 3 deletions

View File

@ -1350,12 +1350,12 @@ void ViewsWindow::SetMenuFocusable(bool focusable) {
if (menu_bar_) { if (menu_bar_) {
menu_bar_->SetMenuFocusable(focusable); menu_bar_->SetMenuFocusable(focusable);
} else { } else if (menu_button_) {
window_->GetViewForID(ID_MENU_BUTTON)->SetFocusable(focusable); menu_button_->SetFocusable(focusable);
if (focusable) { if (focusable) {
// Give focus to menu button. // Give focus to menu button.
window_->GetViewForID(ID_MENU_BUTTON)->RequestFocus(); menu_button_->RequestFocus();
} }
} }