[vlc-commits] lua: playlist/appletrailers: Improve error handling

Marvin Scholz git at videolan.org
Wed Apr 25 13:36:05 CEST 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Apr 25 13:35:28 2018 +0200| [c5c44df639c0b3a16aedf10f87283b4723088d18] | committer: Marvin Scholz

lua: playlist/appletrailers: Improve error handling

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

 share/lua/playlist/appletrailers.lua | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/appletrailers.lua b/share/lua/playlist/appletrailers.lua
index c9015eca75..60148c1375 100644
--- a/share/lua/playlist/appletrailers.lua
+++ b/share/lua/playlist/appletrailers.lua
@@ -50,6 +50,10 @@ function parse_json(url)
         string = string .. line
     end
 
+    if string == "" then
+    	return 0, 0, "Got empty response from server."
+    end
+
     return json.decode(string)
 end
 
@@ -72,7 +76,12 @@ function parse()
     -- Found a video id
     if video_id ~= nil then
         -- Lookup info from the json endpoint
-        local info = filmid_info(video_id)
+        local info, _, err = filmid_info(video_id)
+
+        if err ~= nil then
+        	vlc.msg.err("Error to parse JSON response from Apple trailers: " .. err)
+        	return playlist
+        end
 
         -- Parse data
         if info["clips"] == nil then



More information about the vlc-commits mailing list