Skip to content

Commit 8333def

Browse files
committed
fix: Potential panic during shutdown
1 parent 7c4bf5a commit 8333def

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/server.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,12 @@ func (srv *Web3Gateway) startRPC() error {
254254
}
255255

256256
func (srv *Web3Gateway) stopRPC() {
257-
srv.http.stop()
258-
srv.ws.stop()
257+
if srv.http != nil {
258+
srv.http.stop()
259+
}
260+
if srv.ws != nil {
261+
srv.ws.stop()
262+
}
259263
}
260264

261265
// Wait blocks until the server is closed.

0 commit comments

Comments
 (0)