Index: ui/views/widget/native_widget_aura.cc |
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc |
index b436c8eeeb13e64bcf76829b8827521254693b5f..b757530e6270939f1a45f4e68790e185bfea04d4 100644 |
--- a/ui/views/widget/native_widget_aura.cc |
+++ b/ui/views/widget/native_widget_aura.cc |
@@ -860,7 +860,10 @@ void NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) { |
// and the window may be invisible by that time. |
if (!window_->IsVisible()) |
return; |
- GetWidget()->GetInputMethod()->DispatchKeyEvent(*event); |
+ InputMethod* input_method = GetWidget()->GetInputMethod(); |
+ if (!input_method) |
+ return; |
+ input_method->DispatchKeyEvent(*event); |
if (switches::IsTextInputFocusManagerEnabled()) { |
FocusManager* focus_manager = GetWidget()->GetFocusManager(); |
delegate_->OnKeyEvent(event); |