From c33348e80c7e3e49bcfc587a7fd73b6859623e24 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 11 Feb 2020 16:06:06 +0100 Subject: [PATCH] fix: return an error when ping is not enabled. --- pkg/server/service/managerfactory.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/server/service/managerfactory.go b/pkg/server/service/managerfactory.go index d939e8ce1..e3d82b2a9 100644 --- a/pkg/server/service/managerfactory.go +++ b/pkg/server/service/managerfactory.go @@ -49,7 +49,12 @@ func NewManagerFactory(staticConfiguration static.Configuration, routinesPool *s factory.metricsHandler = metrics.PrometheusHandler() } - factory.pingHandler = staticConfiguration.Ping + // This check is necessary because even when staticConfiguration.Ping == nil , + // the affectation would make factory.pingHandle become a typed nil, which does not pass the nil test, + // and would break things elsewhere. + if staticConfiguration.Ping != nil { + factory.pingHandler = staticConfiguration.Ping + } return factory }