Fix nil pointer dereference in `main.startCollectingStats`

This commit is contained in:
Pedro Pombeiro 2018-02-22 17:51:19 +01:00
parent 134d01fcc1
commit b8eaffb0f6
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 4 additions and 2 deletions

View File

@ -173,8 +173,10 @@ func startCollectingStats(interruptCh <-chan struct{}, nodeManager common.NodeMa
<-interruptCh
if err := server.Shutdown(context.TODO()); err != nil {
log.Printf("Failed to shutdown metrics server: %v", err)
if server != nil {
if err := server.Shutdown(context.TODO()); err != nil {
log.Printf("Failed to shutdown metrics server: %v", err)
}
}
}