From 31beee9599784ad5427dc8c035501688ea38d905 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 3 Jun 2015 18:48:10 +0800 Subject: [PATCH] Check for nullness when comparing webContents, close #1838 --- atom/browser/api/lib/browser-window.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 803fb9207c4..a0c1576ad53 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -88,11 +88,11 @@ BrowserWindow.getFocusedWindow = -> BrowserWindow.fromWebContents = (webContents) -> windows = BrowserWindow.getAllWindows() - return window for window in windows when webContents.equal window.webContents + return window for window in windows when window.webContents?.equal webContents BrowserWindow.fromDevToolsWebContents = (webContents) -> windows = BrowserWindow.getAllWindows() - return window for window in windows when webContents.equal window.devToolsWebContents + return window for window in windows when window.devToolsWebContents?.equal webContents BrowserWindow.fromId = (id) -> BrowserWindow.windows.get id