anyxml.Xml segfaults on a nil input
Closed this issue · 1 comments
dechamps commented
Steps to reproduce:
package main
import (
"fmt"
"github.com/clbanning/anyxml"
)
func main() {
xmlout, err := anyxml.Xml(nil, "root")
if err != nil {
return
}
fmt.Println(string(xmlout))
}
Expected result:
<root />
Actual result:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x4a1f1a]
goroutine 1 [running]:
github.com/clbanning/anyxml.Xml(0x0, 0x0, 0xc420059f68, 0x1, 0x1, 0xc420059f78, 0x403d8c, 0xc42001a178, 0x0, 0x0)
/home/e-t172/go/src/github.com/clbanning/anyxml/anyxml.go:57 +0x6a
main.main()
/home/e-t172/dev/anyxml/nil.go:9 +0x6f
exit status 2