Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinger.TimeOut cause nil pointer error #137

Open
gaorongfu opened this issue Dec 12, 2024 · 0 comments
Open

Pinger.TimeOut cause nil pointer error #137

gaorongfu opened this issue Dec 12, 2024 · 0 comments

Comments

@gaorongfu
Copy link

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/[email protected]/ping.go:520 +0x3f
github.com/prometheus-community/pro-bing.(*Pinger).Run(...)
E:/goProjects/pkg/mod/github.com/prometheus-community/[email protected]/ping.go:511
main.main()
E:/goProjects/src/fping/main.go:44 +0x3d6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant