Merge pull request #721 from nspcc-dev/fix-panic-in-tcptransport-close

network: add a nil check in (*TCPTransport).Close, prevent panic
This commit is contained in:
Roman Khimov 2020-03-05 16:02:15 +03:00 committed by GitHub
commit 44c392450a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,7 +75,9 @@ func (t *TCPTransport) isCloseError(err error) bool {
// Close implements the Transporter interface.
func (t *TCPTransport) Close() {
t.listener.Close()
if t.listener != nil {
t.listener.Close()
}
}
// Proto implements the Transporter interface.