utils_html.go: return empty string if title is empty

This commit is contained in:
Adhityaa Chandrasekar 2019-03-10 09:15:48 -04:00
parent 4945e53553
commit a2c8a73d3e

View File

@ -6,6 +6,10 @@ import (
) )
func htmlTitleRecurse(h *html.Node) string { func htmlTitleRecurse(h *html.Node) string {
if h == nil || h.FirstChild == nil {
return ""
}
if h.Type == html.ElementNode && h.Data == "title" { if h.Type == html.ElementNode && h.Data == "title" {
return h.FirstChild.Data return h.FirstChild.Data
} }