]> git.sesse.net Git - vlc/commitdiff
Prevent errors if item name is nil (I wonder why that happens though).
authorAntoine Cellerier <dionoea@videolan.org>
Mon, 21 Dec 2009 23:08:26 +0000 (00:08 +0100)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 27 Dec 2009 19:12:16 +0000 (20:12 +0100)
share/lua/http/requests/playlist.xml

index 1576216dac655c45de071cabe1b3b51a993f1b3c..28101962545f31ee38903079fc090615a4b80b5e 100644 (file)
@@ -30,14 +30,14 @@ vim:syntax=lua
 function print_playlist(item)
   if item.flags.disabled then return end
   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").."\">")
     for _, c in ipairs(item.children) do
       print_playlist(c)
     end
     print("</node>")
   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).."'/>")
   end
 end