config: fix nil pointer if listening fails

This commit is contained in:
Oliver Gugger 2021-05-19 14:34:41 +02:00
parent 39214e121d
commit fe0b446d38
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -796,7 +796,11 @@ func (l *onDemandListener) Accept() (net.Conn, error) {
// Close closes the listener.
// Any blocked Accept operations will be unblocked and return errors.
func (l *onDemandListener) Close() error {
return l.lis.Close()
if l.lis != nil {
return l.lis.Close()
}
return nil
}
// Addr returns the listener's network address.