[grilo-plugins] metrolyrics: Do not crash when parser fails
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] metrolyrics: Do not crash when parser fails
- Date: Sat, 29 Aug 2015 15:39:21 +0000 (UTC)
commit a692b9e81fcab25b8d417328d5fc7bea9da12bbf
Author: Victor Toso <me victortoso com>
Date: Sat Aug 29 11:51:15 2015 +0200
metrolyrics: Do not crash when parser fails
(lt-grilo-test-ui-0.2:8463): Grilo-WARNING **: [lua-library]
grl-lua-library.c:509: calling source callback function fail
(fetch_page_cb) grl-metrolyrics.lua:99:
attempt to index a nil value (local 'feed')'
https://bugzilla.gnome.org/show_bug.cgi?id=754275
src/lua-factory/sources/grl-metrolyrics.lua | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-metrolyrics.lua b/src/lua-factory/sources/grl-metrolyrics.lua
index 02670d8..cb42f5d 100644
--- a/src/lua-factory/sources/grl-metrolyrics.lua
+++ b/src/lua-factory/sources/grl-metrolyrics.lua
@@ -96,6 +96,11 @@ function metrolyrics_get_lyrics(feed)
-- remove html noise
feed = feed:match(lyrics_body)
+ if not feed then
+ grl.warning ("This Lyrics do not match our parser! Please file a bug!")
+ return nil
+ end
+
for _, it in ipairs (noise_array) do
feed = feed:gsub(it.noise, it.sub)
end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]