mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-02 21:13:32 +00:00
tray: Be robust in case there’s no active webview.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -223,9 +223,12 @@ function toggleTray(): void {
|
||||
ConfigUtil.setConfigItem("trayIcon", true);
|
||||
}
|
||||
|
||||
const selector = "webview:not([class*=disabled])";
|
||||
const webview: WebviewTag = document.querySelector(selector)!;
|
||||
ipcRenderer.sendTo(webview.getWebContentsId(), "toggle-tray", state);
|
||||
const webview = document.querySelector<WebviewTag>(
|
||||
"webview:not([class*=disabled])",
|
||||
);
|
||||
if (webview !== null) {
|
||||
ipcRenderer.sendTo(webview.getWebContentsId(), "toggle-tray", state);
|
||||
}
|
||||
}
|
||||
|
||||
ipcRenderer.on("toggletray", toggleTray);
|
||||
|
||||
Reference in New Issue
Block a user