applications/luci-minidlna: fix possible nil indexing if album art option is unset...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 9 Apr 2012 13:12:25 +0000 (13:12 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 9 Apr 2012 13:12:25 +0000 (13:12 +0000)
applications/luci-minidlna/luasrc/model/cbi/minidlna.lua

index 7c9f4dee19129687186facec8a34a69c1210dcd0..41e2826ee7d007a349a840d3980b10397b389c7e 100644 (file)
@@ -143,16 +143,23 @@ s:taboption("general", DynamicList, "media_dir", translate("Media directories:")
 o = s:taboption("general", DynamicList, "album_art_names", translate("Album art names:"),
        translate("This is a list of file names to check for when searching for album art."))
 o.rmempty = true
-o.placeholder = "Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg"
+o.placeholder = "Cover.jpg"
 
 function o.cfgvalue(self, section)
        local rv = { }
+
        local val = Value.cfgvalue(self, section)
-       if type(val) == "table" then val = table.concat(val, "/") end
+       if type(val) == "table" then
+               val = table.concat(val, "/")
+       elseif not val then
+               val = ""
+       end
+
        local file
        for file in val:gmatch("[^/%s]+") do
                rv[#rv+1] = file
        end
+
        return rv
 end