From a2c8a73d3ed0e5e9d1882c14946c816671c9e50d Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Sun, 10 Mar 2019 09:15:48 -0400 Subject: [PATCH] utils_html.go: return empty string if title is empty --- api/utils_html.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/utils_html.go b/api/utils_html.go index 92cbac7..5b66047 100644 --- a/api/utils_html.go +++ b/api/utils_html.go @@ -6,6 +6,10 @@ import ( ) func htmlTitleRecurse(h *html.Node) string { + if h == nil || h.FirstChild == nil { + return "" + } + if h.Type == html.ElementNode && h.Data == "title" { return h.FirstChild.Data }