From b89a99fe0c6d4090eb5c3d68ec4bf83c88c4c0fe Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 23 Jan 2023 20:21:03 +0100 Subject: [PATCH] Fix another `Failed to call 'Frontend' 'stop' `. https://github.com/Koenkk/zigbee2mqtt/issues/16317 --- lib/extension/frontend.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/extension/frontend.ts b/lib/extension/frontend.ts index 263fe4212..cc8087a1f 100644 --- a/lib/extension/frontend.ts +++ b/lib/extension/frontend.ts @@ -85,7 +85,10 @@ export default class Frontend extends Extension { client.terminate(); }); this.wss?.close(); - return new Promise((cb: () => void) => this.server.close(cb)); + /* istanbul ignore else */ + if (this.server) { + return new Promise((cb: () => void) => this.server.close(cb)); + } } @bind private onRequest(request: http.IncomingMessage, response: http.ServerResponse): void {