aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-17 16:11:11 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-17 16:11:11 +0100
commit430114cd5ab344a6a39fd9e6d3857ade78e2f8e3 (patch)
tree42e07d6e3b562e51cc63aad5b2423590970b4b8d /net
parent55adc40b43053a63bc33bb26396e8c5eb0680eb8 (diff)
downloadprosody-430114cd5ab344a6a39fd9e6d3857ade78e2f8e3.tar.gz
prosody-430114cd5ab344a6a39fd9e6d3857ade78e2f8e3.zip
net.server: Fix potential nil handler usage
Diffstat (limited to 'net')
-rw-r--r--net/server.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/server.lua b/net/server.lua
index 0097be3c..77bc2f5c 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -325,7 +325,9 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
if not ( forced or fatalerror ) then
handler.sendbuffer( )
if bufferqueuelen ~= 0 then -- try again...
- handler.write = nil -- ... but no further writing allowed
+ if handler then
+ handler.write = nil -- ... but no further writing allowed
+ end
toclose = true
return false
end
@@ -337,9 +339,11 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
socket:close( )
_sendlistlen = removesocket( _sendlist, socket, _sendlistlen )
_socketlist[ socket ] = nil
- _writetimes[ handler ] = nil
- _closelist[ handler ] = nil
- handler = nil
+ if handler then
+ _writetimes[ handler ] = nil
+ _closelist[ handler ] = nil
+ handler = nil
+ end
socket = nil
mem_free( )
if server then