From 8bdb806a53ab53548a7dd2d6239e471d7bc736e1 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Thu, 3 Aug 2023 13:20:08 +0200 Subject: [PATCH] Check that buffering is initialized before calling shutdown on it Signed-off-by: Rohit Nayak --- go/vt/vtgate/tabletgateway.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/tabletgateway.go b/go/vt/vtgate/tabletgateway.go index b468543e24d..7b833928e2e 100644 --- a/go/vt/vtgate/tabletgateway.go +++ b/go/vt/vtgate/tabletgateway.go @@ -201,7 +201,9 @@ func (gw *TabletGateway) WaitForTablets(tabletTypesToWait []topodatapb.TabletTyp // Close shuts down underlying connections. // This function hides the inner implementation. func (gw *TabletGateway) Close(_ context.Context) error { - gw.buffer.Shutdown() + if gw.buffer != nil { + gw.buffer.Shutdown() + } return gw.hc.Close() }