Changeset

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
parents 814:f12b1ddd458d
children 816:c031ead9896d
files net/server.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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