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

Pierre Ynard git at videolan.org
Tue Mar 15 02:07:40 CET 2011


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

luarc: fix interface crash on object command with missing arguments
(cherry picked from commit f271a2effd810941493500bf22b8dea92a0386a9)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

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

 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 f4c0acf..7a801d4 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