contrib/rss_downloader: fix nullable usage for title and link
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 6 Nov 2017 19:40:23 +0000 (14:40 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 6 Nov 2017 19:40:23 +0000 (14:40 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/rss_downloader/src/rss_downloader.nit

index a738c05..022543e 100644 (file)
@@ -274,6 +274,16 @@ redef class Text
                        var title = item[tool_config.as(not null).tag_title].first.as(XMLStartTag).data
                        var link = item[tool_config.as(not null).tag_link].first.as(XMLStartTag).data
 
+                       if title == null then
+                               print_error "RSS Parse Error: title is null"
+                               return elements
+                       end
+
+                       if link == null then
+                               print_error "RSS Parse Error: link is null"
+                               return elements
+                       end
+
                        elements.add new Element(title, link)
                end