anaskhan96 / soup

Web Scraper in Go, similar to BeautifulSoup
MIT License
2.18k stars 168 forks source link

Empty strings throw errors on Text() #25

Closed nick-stocks closed 4 years ago

nick-stocks commented 6 years ago

When doing a FindAll(“td”), then calling Text() on a result, a null pointer error is thrown whenever an empty/nil value is encountered in the slice.

“runtime error: invalid memory address or nil pointer dereference errorString”

An error object should be returned instead, or an empty string.

vitaliytv commented 5 years ago

maybe fixed in: https://github.com/anaskhan96/soup/commit/bd6615df1f00ccd4776ea9acc95b41162b55de7c

you can upgrade: go get github.com/anaskhan96/soup@00be3d730c89ee1efa038324e9bc7355ad23f93b

iJebus commented 5 years ago

I think this issue is still live, or at least a related issue exists. My code is doing a FindNextElementSibling() on a Root that may be empty, and I'm getting panics.

Not a huge deal and can be worked around, but kinda tedious.

anaskhan96 commented 4 years ago

Almost a year and the discussion gone's stale + this has been fixed in the commit mentioned above. Closing this unless this issue arises again.