]> git.sesse.net Git - vlc/commitdiff
*.lua: handle recv() returning nil
authorRafaël Carré <rafael.carre@gmail.com>
Sun, 19 Jun 2011 16:21:48 +0000 (12:21 -0400)
committerRafaël Carré <rafael.carre@gmail.com>
Sun, 19 Jun 2011 16:21:48 +0000 (12:21 -0400)
share/lua/intf/cli.lua
share/lua/intf/modules/host.lua

index 4662cbbe91f697ca17b2eaa844e66b82b6a819c8..2663173ef79cddd78daac3635500ed1fb97f9ebf 100644 (file)
@@ -787,7 +787,7 @@ while not vlc.misc.should_die() do
     for _, client in pairs(read) do
         local input = client:recv(1000)
 
-        if input == nil or input == "" -- the telnet client program has left
+        if input == nil -- the telnet client program has left
             or ((client.type == host.client_type.net
                  or client.type == host.client_type.telnet)
                 and input == "\004") then
index 9d421918bfefcdd3930a02e3e2a4d7ad2b21e02d..8b52e0bf08508efca86d6f588edff54255c8cae7 100644 (file)
@@ -52,6 +52,7 @@ Example use:
         -- handle clients in read mode
         for _, client in pairs(read) do
             local str = client:recv(1000)
+            if not str then break end
             str = string.gsub(str,"\r?\n$","")
             client.buffer = "Got `"..str.."'.\r\n"
             client:switch_status( host.status.write )