Skip to content

Commit fe0b446

Browse files
committed
config: fix nil pointer if listening fails
1 parent 39214e1 commit fe0b446

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,11 @@ func (l *onDemandListener) Accept() (net.Conn, error) {
796796
// Close closes the listener.
797797
// Any blocked Accept operations will be unblocked and return errors.
798798
func (l *onDemandListener) Close() error {
799-
return l.lis.Close()
799+
if l.lis != nil {
800+
return l.lis.Close()
801+
}
802+
803+
return nil
800804
}
801805

802806
// Addr returns the listener's network address.

0 commit comments

Comments
 (0)