fix check for undefined `ws`

fixes https://github.com/nbd-wtf/nostr-tools/issues/271
This commit is contained in:
fiatjaf 2023-08-11 07:09:39 -03:00
parent de7e128818
commit 9efdd16e26
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
1 changed files with 2 additions and 2 deletions

View File

@ -386,8 +386,8 @@ export function relayInit(
listeners = newListeners()
subListeners = {}
pubListeners = {}
if (ws.readyState === WebSocket.OPEN) {
ws?.close()
if (ws?.readyState === WebSocket.OPEN) {
ws.close()
}
},
get status() {