Skip to content

Commit

Permalink
Add nil check to prevent panics (#14902)
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>
  • Loading branch information
GuptaManan100 authored Jan 9, 2024
1 parent 9e3b332 commit 12e75b1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/vt/vtgate/vtgate.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,10 @@ func Init(
st.Start()
}
srv := initMySQLProtocol(vtgateInst)
servenv.OnTermSync(srv.shutdownMysqlProtocolAndDrain)
servenv.OnClose(srv.rollbackAtShutdown)
if srv != nil {
servenv.OnTermSync(srv.shutdownMysqlProtocolAndDrain)
servenv.OnClose(srv.rollbackAtShutdown)
}
})
servenv.OnTerm(func() {
if st != nil && enableSchemaChangeSignal {
Expand Down

0 comments on commit 12e75b1

Please sign in to comment.