Skip to content

invalid memory address or nil pointer dereference #63

@acook

Description

@acook

This happens when calling .InnerText when a page happens to be blank (such as a redirect).

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6a496a]

goroutine 8 [running]:
github.com/antchfx/htmlquery.(*NodeNavigator).NodeType(0xc0000a08b8, 0x40f35b)
        /home/acook/go/pkg/mod/github.com/antchfx/htmlquery@v1.2.3/query.go:205 +0x2a
github.com/antchfx/xpath.axisPredicate.func1(0x7afca0, 0xc0000a08b8, 0x7f460faa35b8)
        /home/acook/go/pkg/mod/github.com/antchfx/xpath@v1.1.6/build.go:45 +0x51
github.com/antchfx/xpath.(*builder).processAxisNode.func1(0x7afca0, 0xc0000a08b8, 0xc0000adc10)
        /home/acook/go/pkg/mod/github.com/antchfx/xpath@v1.1.6/build.go:82 +0x46
github.com/antchfx/xpath.(*descendantQuery).Select.func1(0x71ffa0, 0xc00020a900)
        /home/acook/go/pkg/mod/github.com/antchfx/xpath@v1.1.6/query.go:252 +0x1e3
github.com/antchfx/xpath.(*descendantQuery).Select(0xc0000dc640, 0x7a89a0, 0xc0000ca740, 0x20, 0x705340)
        /home/acook/go/pkg/mod/github.com/antchfx/xpath@v1.1.6/query.go:284 +0x34
github.com/antchfx/xpath.(*NodeIterator).MoveNext(0xc0000ca740, 0xc0000ca740)
        /home/acook/go/pkg/mod/github.com/antchfx/xpath@v1.1.6/xpath.go:86 +0x49
github.com/antchfx/htmlquery.QuerySelector(0x0, 0xc0000ca700, 0xc0000ca700)
        /home/acook/go/pkg/mod/github.com/antchfx/htmlquery@v1.2.3/query.go:73 +0xe8
github.com/antchfx/htmlquery.Query(0x0, 0x744dbd, 0x7, 0x7a8e00, 0xc00020a810, 0x0)
        /home/acook/go/pkg/mod/github.com/antchfx/htmlquery@v1.2.3/query.go:67 +0x85
main.getElementFromURL(0xc0000b27d0, 0x4, 0x744dbd, 0x7, 0x1, 0x11)
        /home/acook/Source/Mein/Go/TuneBot/main.go:142 +0x75

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions