Commit 054c7f95 authored by Antoine Cellerier's avatar Antoine Cellerier

Prevent errors if item name is nil (I wonder why that happens though).

parent 66cdfd6b
...@@ -30,14 +30,14 @@ vim:syntax=lua ...@@ -30,14 +30,14 @@ vim:syntax=lua
function print_playlist(item) function print_playlist(item)
if item.flags.disabled then return end if item.flags.disabled then return end
if item.children then if item.children then
local name = vlc.strings.convert_xml_special_chars(item.name) local name = vlc.strings.convert_xml_special_chars(item.name or "")
print("<node id=\""..tostring(item.id).."\" name=\""..name.."\" ro=\""..(item.flags.ro and "ro" or "rw").."\">") print("<node id=\""..tostring(item.id).."\" name=\""..name.."\" ro=\""..(item.flags.ro and "ro" or "rw").."\">")
for _, c in ipairs(item.children) do for _, c in ipairs(item.children) do
print_playlist(c) print_playlist(c)
end end
print("</node>") print("</node>")
else else
local name, path = vlc.strings.convert_xml_special_chars(item.name,item.path or "") local name, path = vlc.strings.convert_xml_special_chars(item.name or "",item.path or "")
print("<leaf id='"..tostring(item.id).."' uri='"..path.."' name='"..name.."' ro='"..(item.flags.ro and "ro" or "rw").."' duration='"..tostring(item.duration).."'/>") print("<leaf id='"..tostring(item.id).."' uri='"..path.."' name='"..name.."' ro='"..(item.flags.ro and "ro" or "rw").."' duration='"..tostring(item.duration).."'/>")
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment