From 29a09695045c8c444ce74360ad942e5ec622b173 Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Fri, 11 Jun 2021 08:45:14 +0900 Subject: [PATCH] page#title returns empty string if no title tag --- src/mechanize/page.cr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mechanize/page.cr b/src/mechanize/page.cr index 3b459c9..7ab77ba 100644 --- a/src/mechanize/page.cr +++ b/src/mechanize/page.cr @@ -12,7 +12,12 @@ class MechanizeCr::Page < MechanizeCr::File end def title - title = parser.css("title").first.inner_text + title_node = css("title") + if title_node.empty? + "" + else + title_node.first.inner_text + end end def forms