[grilo-plugins] thegamesdb: Check for empty list



commit 6a06a6fdbafb16d3e4137bfe2522845255eada49
Author: Victor Toso <me victortoso com>
Date:   Tue Mar 20 07:49:12 2018 +0100

    thegamesdb: Check for empty list
    
    Checking if table exists is not enough. If xml field exists,
    grl.lua.xml.string_to_table() will include that into the returning
    table.
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=794504

 src/lua-factory/sources/grl-thegamesdb.lua |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-thegamesdb.lua b/src/lua-factory/sources/grl-thegamesdb.lua
index f492f87..60cd0e7 100644
--- a/src/lua-factory/sources/grl-thegamesdb.lua
+++ b/src/lua-factory/sources/grl-thegamesdb.lua
@@ -81,7 +81,8 @@ function get_id(results, title)
   local results_table = grl.lua.xml.string_to_table(results)
   if not results_table or
      not results_table.Data or
-     not results_table.Data.Game then
+     not results_table.Data.Game or
+     #results_table.Data.Game == 0 then
     return nil
   end
   for index, game in pairs(results_table.Data.Game) do


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]