From a5e8f87a26cdb18cd3ee3eead9e37a420e007d46 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 23 Sep 2018 12:32:32 -0500 Subject: [PATCH] Add error for non-existent playlists --- src/invidious/playlists.cr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index e14a7709..d78d68bf 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -153,8 +153,11 @@ def fetch_playlist(plid) , "") document = XML.parse_html(body) - title = document.xpath_node(%q(//h1[@class="pl-header-title"])).not_nil!.content - title = title.strip(" \n") + title = document.xpath_node(%q(//h1[@class="pl-header-title"])) + if !title + raise "Playlist does not exist." + end + title = title.content.strip(" \n") description_html = document.xpath_node(%q(//span[@class="pl-header-description-text"]/div/div[1])) description_html, description = html_to_content(description_html)