]> git.e2factory.org Git - e2factory.git/commitdiff
Fix crash on invalid src.licences data type
authorTobias Ulmer <tu@emlix.com>
Tue, 15 Apr 2014 14:49:37 +0000 (16:49 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/scm.lua

index 03b355177b42b10f0c30df3868e0036c49479761..43b996803d066efe85b01892643b5ea09c50e037 100644 (file)
@@ -156,7 +156,7 @@ local function source_apply_default_licences(info, sourcename)
                " licence attribute is deprecated. Replace by licences.")
     src.licences = src.licence
   end
-  if not src.licences then
+  if src.licences == nil then
     e2lib.warnf("WDEFAULT", "in source %s:", src.name)
     e2lib.warnf("WDEFAULT",
                " licences attribute missing. Defaulting to empty list.")
@@ -167,6 +167,12 @@ local function source_apply_default_licences(info, sourcename)
                " licences attribute is not in table format. Converting.")
     src.licences = { src.licences }
   end
+
+  if type(src.licences) ~= "table" then
+      e:append("licences attribute is of invalid type")
+      return false, e
+  end
+
   for i, s in pairs(src.licences) do
     if type(i) ~= "number" or type(s) ~= "string" then
       e:append("licences attribute is not a list of strings")