Skip to content

Commit eb71dc9

Browse files
author
chaehni
authored
[shttp] Fixes a nil-pointer exception calling transport.Close() (#78)
* fix transport close
1 parent c063014 commit eb71dc9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/shttp/transport.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,11 @@ func unmangleSCIONAddr(host string) (addr.IA, addr.HostAddr, error) {
197197
}
198198

199199
// Close closes the QUIC connections that this RoundTripper has used
200-
func (t *Transport) Close() error {
201-
err := t.rt.Close()
200+
func (t *Transport) Close() (err error) {
201+
202+
if t.rt != nil {
203+
err = t.rt.Close()
204+
}
202205

203206
// quic.Session.Close (which is called by RoundTripper.Close()) will NOT
204207
// close the underlying connections, so we do it manually here.

0 commit comments

Comments
 (0)