From: Cheng Zhao Date: Wed, 3 Jun 2015 10:48:10 +0000 (+0800) Subject: Check for nullness when comparing webContents, close #1838 X-Git-Tag: v0.27.3~15 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=31beee9599784ad5427dc8c035501688ea38d905;p=electron.git Check for nullness when comparing webContents, close #1838 --- diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 803fb920..a0c1576a 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