[vlc-commits] luarc: fix interface crash on object command with missing arguments

Pierre Ynard git at videolan.org
Tue Mar 15 02:04:45 CET 2011


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Mar 15 02:04:05 2011 +0100| [f271a2effd810941493500bf22b8dea92a0386a9] | committer: Pierre Ynard

luarc: fix interface crash on object command with missing arguments

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f271a2effd810941493500bf22b8dea92a0386a9
---

 share/lua/intf/rc.lua |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/share/lua/intf/rc.lua b/share/lua/intf/rc.lua
index 5a74eb1..1bac517 100644
--- a/share/lua/intf/rc.lua
+++ b/share/lua/intf/rc.lua
@@ -650,10 +650,17 @@ function call_libvlc_command(cmd,client,arg)
 end
 
 function call_object_command(cmd,client,arg)
-    local var, val = split_input(arg)
+    local var, val
+    if arg ~= nil then
+        var, val = split_input(arg)
+    end
     local ok, vlcmsg, vlcerr, vlcerrmsg = pcall( vlc.var.command, cmd, var, val )
     if not ok then
-        client:append("Error in `"..cmd.." "..var.." "..val.."' ".. vlcmsg) -- when pcall fails the 2nd arg is the error message
+        local v = var or ""
+        if v ~= "" then v = " " .. v end
+        local v2 = val or ""
+        if v2 ~= "" then v2 = " " .. v2 end
+        client:append("Error in `"..cmd..v..v2.."' ".. vlcmsg) -- when pcall fails the 2nd arg is the error message
     end
     if vlcmsg ~= "" then
         client:append(vlcmsg)



More information about the vlc-commits mailing list