mirror of
https://github.com/golang/go
synced 2024-11-20 04:44:40 -07:00
net: fix nil deref in testTimeout when Dial fails
Pointed out by Scott Schwartz. Fixes #637. R=scotts CC=golang-dev https://golang.org/cl/225042
This commit is contained in:
parent
f1550482fa
commit
74b131c0ab
@ -12,10 +12,11 @@ import (
|
||||
|
||||
func testTimeout(t *testing.T, network, addr string, readFrom bool) {
|
||||
fd, err := Dial(network, "", addr)
|
||||
defer fd.Close()
|
||||
if err != nil {
|
||||
t.Errorf("dial %s %s failed: %v", network, addr, err)
|
||||
return
|
||||
}
|
||||
defer fd.Close()
|
||||
t0 := time.Nanoseconds()
|
||||
fd.SetReadTimeout(1e8) // 100ms
|
||||
var b [100]byte
|
||||
|
Loading…
Reference in New Issue
Block a user