From 2f95b6b562bc89de53554ad10be34eda3bec684a Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Thu, 8 Sep 2016 16:13:47 +0200 Subject: [PATCH] =?UTF-8?q?-=20Fixe=20string:isempty()=20-=20Tagesschau:?= =?UTF-8?q?=20HTTP-Fehlercode=20wird=20jetzt=20vor=20dem=20JSON-Encoding?= =?UTF-8?q?=20gepr=C3=BCft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otouto/plugins/tagesschau.lua | 4 ++-- otouto/utilities.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/otouto/plugins/tagesschau.lua b/otouto/plugins/tagesschau.lua index 1c74e42..2eb61d6 100644 --- a/otouto/plugins/tagesschau.lua +++ b/otouto/plugins/tagesschau.lua @@ -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') diff --git a/otouto/utilities.lua b/otouto/utilities.lua index ef18b6a..0516d3e 100644 --- a/otouto/utilities.lua +++ b/otouto/utilities.lua @@ -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