- Fixe string:isempty()

- Tagesschau: HTTP-Fehlercode wird jetzt vor dem JSON-Encoding geprüft
This commit is contained in:
Andreas Bielawski 2016-09-08 16:13:47 +02:00
parent 271c9c5f84
commit 2f95b6b562
2 changed files with 3 additions and 3 deletions

View File

@ -16,10 +16,10 @@ end
function tagesschau:get_tagesschau_article(article)
local url = BASE_URL..'/'..article..'.json'
local res,code = https.request(url)
local data = json.decode(res)
local res, code = https.request(url)
if code == 404 then return "Artikel nicht gefunden!" end
if code ~= 200 then return "HTTP-Fehler" end
local data = json.decode(res)
if not data then return "HTTP-Fehler" end
if data.type ~= "story" then
print('Typ "'..data.type..'" wird nicht unterstützt')

View File

@ -349,7 +349,7 @@ end
-- Returns true if the string is blank/empty
function string:isempty()
self = self:trim()
self = utilities.trim(self)
return self == nil or self == ''
end