From 409f880f3669fe98471469dd0850bb848bee972f Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sun, 13 Nov 2022 07:51:50 +0100 Subject: [PATCH] Do not crash on ctrl close of invalid connection --- lib/teeworlds_server.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/teeworlds_server.rb b/lib/teeworlds_server.rb index 3a2f484..0792765 100644 --- a/lib/teeworlds_server.rb +++ b/lib/teeworlds_server.rb @@ -149,6 +149,11 @@ class TeeworldsServer end def send_ctrl_close(client, reason) + # when clients disconnect + # during the connection process + # we do not care + return if client.nil? + msg = [NET_CTRLMSG_CLOSE] msg += Packer.pack_str(reason) unless reason.nil? @netbase.set_peer_token(client.token)