Skip to content

Commit c60d504

Browse files
author
Daniel Spitzer
committed
fix(hub): Relax error messages for forgetApp()
1 parent caed413 commit c60d504

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/hub.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ export function hub(chrome) {
7272

7373
function forgetApp(targetWindow) {
7474
try {
75-
const { appId, token } = appWindows.get(targetWindow);
76-
debug('Forgetting app %o', appId);
77-
appPongs
78-
.get(token)
79-
.timeoutIds.forEach(timeoutId => clearTimeout(timeoutId));
80-
appPongs.delete(token);
81-
appWindows.delete(targetWindow);
75+
const { appId, token } = appWindows.get(targetWindow) || {};
76+
if (appId && token) {
77+
debug('Forgetting app %o', appId);
78+
appPongs
79+
.get(token)
80+
.timeoutIds.forEach(timeoutId => clearTimeout(timeoutId));
81+
appPongs.delete(token);
82+
appWindows.delete(targetWindow);
83+
}
8284
} catch (error) {
8385
debug("App couldn't be forgotten in %o - %o", targetWindow, error);
8486
}

0 commit comments

Comments
 (0)