Skip to content

Pinger.TimeOut cause nil pointer error #137

Open
@gaorongfu

Description

@gaorongfu

code :

pinger, err := probing.NewPinger(ip)
if err != nil {
fmt.Printf("%s : %s", allIp[idx], err.Error())
return
}
pinger.SetPrivileged(true)
pinger.Timeout = time.Second
pinger.Count = 3

            err := pinger.Run() // Blocks until finished.
		if err != nil {
			panic(err)
		}

error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0xf0 pc=0xbb5fff]

goroutine 1 [running]:
github.com/prometheus-community/pro-bing.(*Pinger).RunWithContext(0xc5d220?, {0xc5e250?, 0xdbf6e0?})
E:/goProjects/pkg/mod/github.com/prometheus-community/pro-bing@v0.5.0/ping.go:520 +0x3f
github.com/prometheus-community/pro-bing.(*Pinger).Run(...)
E:/goProjects/pkg/mod/github.com/prometheus-community/pro-bing@v0.5.0/ping.go:511
main.main()
E:/goProjects/src/fping/main.go:44 +0x3d6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Pinger.TimeOut cause nil pointer error · Issue #137 · prometheus-community/pro-bing