1
0
mirror of https://github.com/golang/go synced 2024-11-20 10:54:49 -07:00

net: fix test to avoid unintentional nil pointer dereference

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6248065
This commit is contained in:
Mikio Hara 2012-05-31 06:12:24 +09:00
parent 6a5660f160
commit aad8e95474

View File

@ -555,19 +555,19 @@ func TestWildWildcardListener(t *testing.T) {
}
}()
if ln, err := Listen("tcp", ""); err != nil {
if ln, err := Listen("tcp", ""); err == nil {
ln.Close()
}
if ln, err := ListenPacket("udp", ""); err != nil {
if ln, err := ListenPacket("udp", ""); err == nil {
ln.Close()
}
if ln, err := ListenTCP("tcp", nil); err != nil {
if ln, err := ListenTCP("tcp", nil); err == nil {
ln.Close()
}
if ln, err := ListenUDP("udp", nil); err != nil {
if ln, err := ListenUDP("udp", nil); err == nil {
ln.Close()
}
if ln, err := ListenIP("ip:icmp", nil); err != nil {
if ln, err := ListenIP("ip:icmp", nil); err == nil {
ln.Close()
}
}