Diff

net/server.lua @ 815:cf8392613f46

net.server: Fix some more potential nil handler accesses
author Matthew Wild <mwild1@gmail.com>
date Wed, 18 Feb 2009 19:23:29 +0000
parent 775:d4b6714fc829
child 846:77244ba297ac
line wrap: on
line diff
--- a/net/server.lua	Mon Feb 16 15:44:54 2009 +0000
+++ b/net/server.lua	Wed Feb 18 19:23:29 2009 +0000
@@ -369,7 +369,9 @@
         end
         bufferqueuelen = bufferqueuelen + 1
         bufferqueue[ bufferqueuelen ] = data
-        _writetimes[ handler ] = _writetimes[ handler ] or _currenttime
+        if handler then
+        	_writetimes[ handler ] = _writetimes[ handler ] or _currenttime
+        end
         return true
     end
     handler.write = write
@@ -470,7 +472,7 @@
             out_put( "server.lua: client ", ip, ":", clientport, " error: ", err )
             fatalerror = true
             disconnect( handler, err )
-            handler.close( )
+            _ = handler and handler.close( )
             return false
         end
     end