diff --git a/atom/browser/common_web_contents_delegate_mac.mm b/atom/browser/common_web_contents_delegate_mac.mm index eeb87f2665d2..f473c1406216 100644 --- a/atom/browser/common_web_contents_delegate_mac.mm +++ b/atom/browser/common_web_contents_delegate_mac.mm @@ -23,8 +23,9 @@ void CommonWebContentsDelegate::HandleKeyboardEvent( if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen()) ExitFullscreenModeForTab(source); - if (event.os_event.window) { - AtomNSWindow* native_window = static_cast(event.os_event.window); + NSWindow* window = event.os_event.window; + if (window && [window isKindOfClass:[AtomNSWindow class]]) { + AtomNSWindow* native_window = static_cast(window); [native_window redispatchKeyEvent:event.os_event]; } }