Skip to content

Commit

Permalink
Merge branch 'Dharmey747/soupnilfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteSizedMarius committed Feb 16, 2024
2 parents 6dcd1c7 + 5167b19 commit e965cf6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions soup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e965cf6

Please sign in to comment.