Hotfix. Added checking for nil subnodes
This commit is contained in:
parent
53f872a72d
commit
8817bd521a
2 changed files with 7 additions and 3 deletions
|
|
@ -43,9 +43,13 @@ func GetPricesScg(name string) ([]CardPrice, error) {
|
|||
}
|
||||
}
|
||||
editionNode := htmlquery.FindOne(block, "//p[@class=\"hawk-results-item__category\"]/a")
|
||||
price.Edition = editionNode.FirstChild.Data
|
||||
if editionNode.FirstChild != nil {
|
||||
price.Edition = editionNode.FirstChild.Data
|
||||
}
|
||||
priceNode := htmlquery.FindOne(block, "//div[contains(concat(' ',normalize-space(@class),' '),' hawk-results-item__options-table-cell--price ')]")
|
||||
price.Price = priceNode.FirstChild.Data
|
||||
if priceNode.FirstChild != nil {
|
||||
price.Price = priceNode.FirstChild.Data
|
||||
}
|
||||
results = append(results, price)
|
||||
}
|
||||
return results, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue