From 4357bd1bebfacc0f88a04a60217353ac59b82887 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 14 Jan 2021 22:07:53 -0300 Subject: [PATCH] fix bug when removing key from listenership. --- listener.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/listener.go b/listener.go index 66fcd99..70f5083 100644 --- a/listener.go +++ b/listener.go @@ -37,6 +37,11 @@ func unwatchPubKey(excludedKey string, ws *websocket.Conn) { if existingWs == ws { continue } + if i == len(wss) { + // if we reach this point it is because the key we were + // excluding wasn't here in the first place + return + } newWss[i] = existingWs i++ }