diff --git a/soup.go b/soup.go index 922dd2c..34dd3e6 100644 --- a/soup.go +++ b/soup.go @@ -413,6 +413,14 @@ func (r Root) Attrs() map[string]string { // Text returns the string inside a non-nested element func (r Root) Text() string { + if r.Pointer == nil { + if debug { + panic("Pointer text node is nil") + } + + return "" + } + k := r.Pointer.FirstChild checkNode: if k != nil && k.Type != html.TextNode {