mirror of https://github.com/golang/go.git
Check RemoteAddr isn't nil before deref
This commit is contained in:
parent
c5463218a2
commit
ff3505d1d0
|
|
@ -1856,7 +1856,9 @@ func isCommonNetReadError(err error) bool {
|
||||||
|
|
||||||
// Serve a new connection.
|
// Serve a new connection.
|
||||||
func (c *conn) serve(ctx context.Context) {
|
func (c *conn) serve(ctx context.Context) {
|
||||||
c.remoteAddr = c.rwc.RemoteAddr().String()
|
if ra := c.rwc.RemoteAddr(); ra != nil {
|
||||||
|
c.remoteAddr = ra.String()
|
||||||
|
}
|
||||||
ctx = context.WithValue(ctx, LocalAddrContextKey, c.rwc.LocalAddr())
|
ctx = context.WithValue(ctx, LocalAddrContextKey, c.rwc.LocalAddr())
|
||||||
var inFlightResponse *response
|
var inFlightResponse *response
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue