From 42f3ff16348fe0c4bfc433adff69244fd46eaaad Mon Sep 17 00:00:00 2001 From: Shinichiro Oba Date: Fri, 9 Sep 2022 17:18:02 +0900 Subject: [PATCH] Safety improvements --- .../Sources/ScratchLink/Resources/inject-scratch-link.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ScratchLink/Sources/ScratchLink/Resources/inject-scratch-link.js b/ScratchLink/Sources/ScratchLink/Resources/inject-scratch-link.js index ca94fa2..05dcaf6 100644 --- a/ScratchLink/Sources/ScratchLink/Resources/inject-scratch-link.js +++ b/ScratchLink/Sources/ScratchLink/Resources/inject-scratch-link.js @@ -31,7 +31,9 @@ class ScratchLink { socketId: this.socketId }); - this.onclose(); + if (this.onclose) { + this.onclose(); + } ScratchLink.sockets.delete(this.socketId); }