Fix a crash in httpGetXpath()
doc, err := gokogiri.ParseHtml(buf) can leave both err and doc nil. Added a check condition for that.configurable-file-paths
parent
130b600923
commit
294fb3fdf8
|
@ -62,6 +62,9 @@ func httpGetXpath(l, x string) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if doc.Root() == nil {
|
||||
return "", errElementNotFound
|
||||
}
|
||||
|
||||
xpath := xpath.Compile(x)
|
||||
sr, err := doc.Root().Search(xpath)
|
||||
|
|
Loading…
Reference in New Issue