flow manager: Don't attempt to close nil listeners.
This can happen if we fail to listen and we've already shut down the
flow manager.
Change-Id: I6558198a92d55aab182c75337cc4cff94236cdc2
diff --git a/runtime/internal/flow/manager/manager.go b/runtime/internal/flow/manager/manager.go
index b9d9c78..ae98029 100644
--- a/runtime/internal/flow/manager/manager.go
+++ b/runtime/internal/flow/manager/manager.go
@@ -195,7 +195,9 @@
defer m.ls.mu.Unlock()
m.ls.mu.Lock()
if m.ls.listeners == nil {
- ln.Close()
+ if ln != nil {
+ ln.Close()
+ }
return nil, flow.NewErrBadState(ctx, NewErrManagerClosed(ctx))
}
errKey := struct{ Protocol, Address string }{Protocol: protocol, Address: address}