[vlc-commits] metachannels: don't crash if image tag is missing

Pierre Ynard git at videolan.org
Sat Feb 11 23:36:33 CET 2012


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Feb 11 23:35:44 2012 +0100| [e0a19b96e8a920a37ba59f4418bf955df18b0561] | committer: Pierre Ynard

metachannels: don't crash if image tag is missing

Fixes #6008

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

 share/lua/sd/metachannels.lua |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/share/lua/sd/metachannels.lua b/share/lua/sd/metachannels.lua
index 3913377..21152e6 100644
--- a/share/lua/sd/metachannels.lua
+++ b/share/lua/sd/metachannels.lua
@@ -59,9 +59,14 @@ function main()
         if( item.name == 'item' ) then
             simplexml.add_name_maps( item )
             local url = string.gsub( item.children_map['link'][1].children[1], '&', '&' )
+            local title = item.children_map['title'][1].children[1]
+            local arturl = nil
+            if item.children_map['image'] ~= nil then
+                arturl = item.children_map['image'][1].children_map['url'][1].children[1]
+            end
             local node = vlc.sd.add_item( { path = url,
-                                            title = item.children_map['title'][1].children[1],
-                                            arturl = item.children_map['image'][1].children_map['url'][1].children[1] } )
+                                            title = title,
+                                            arturl = arturl } )
         end
     end
 end



More information about the vlc-commits mailing list