Skip to content

Commit

Permalink
Fix test crash due to no os_event
Browse files Browse the repository at this point in the history
- Before enabling the new keyboard shortcuts this crash needs to
  be fixed.
- When keys are injected from dev tools, the event won't have an
  os_event so just fallback to the usual code path

Test: browser_tests --gtest_filter="DevToolsTest*"
Change-Id: I7af73887b28c5ecacdb50ab0aab0f8a336c8fd55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2880800
Commit-Queue: Zentaro Kavanagh <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: James Cook <[email protected]>
Cr-Commit-Position: refs/heads/master@{#880794}
  • Loading branch information
Zentaro Kavanagh authored and Chromium LUCI CQ committed May 9, 2021
1 parent af2feb7 commit cd8be1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/content_accelerators/accelerator_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ ui::Accelerator GetAcceleratorFromNativeWebKeyboardEvent(
// TODO: This must be the same as below and it's simpler.
// Cleanup if this change sticks.
auto* os_event = static_cast<ui::KeyEvent*>(event.os_event);
return ui::Accelerator(*os_event);

// If there is no |os_event| fall through to the default code path.
// This can occur when keys are injected from dev tools.
if (os_event)
return ui::Accelerator(*os_event);
}
#endif
Accelerator::KeyState key_state =
Expand Down

0 comments on commit cd8be1e

Please sign in to comment.