[vlc-devel] [PATCH] lua/intf/cli: fix invalid concatenation of empty string
Filip Roséen
filip at atch.se
Wed Oct 26 14:00:41 CEST 2016
If an item lacks a name the value of "item.name" is nil, meaning that
it is an error trying to use it during concatenation.
These changes simply conditionally concatenates the leading " - " and the name
if the latter is not nil, otherwise an empty string is used in its place.
fixes #17545
---
share/lua/intf/cli.lua | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 3c58b87..c631281 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -215,7 +215,8 @@ function playlist(name,client,arg)
function playlist0(item,prefix)
local prefix = prefix or ""
if not item.flags.disabled then
- local str = "| "..prefix..tostring(item.id).." - "..item.name
+ local str = "| "..prefix..tostring(item.id)..
+ (item.name == nil and "" or " - "..item.name)
if item.duration > 0 then
str = str.." ("..common.durationtostring(item.duration)..")"
end
--
2.10.0
More information about the vlc-devel
mailing list