From 0d4b1e14fa0ee3a40ae5be489bd1de1c2a74fd05 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 27 Aug 2021 19:27:58 +0200 Subject: [PATCH] prevent segmentation violation if request fails Signed-off-by: Markus Blaschke --- metrics/insights.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metrics/insights.go b/metrics/insights.go index dc82ee8..202f30b 100644 --- a/metrics/insights.go +++ b/metrics/insights.go @@ -54,9 +54,11 @@ func (p *MetricProber) FetchMetricsFromTarget(client *insights.MetricsClient, ta insights.Data, p.settings.MetricNamespace, ) - p.logger.Debugf("sent request to %s", result.Request.URL.String()) if err == nil { + if result.Request.URL != nil { + p.logger.Debugf("sent request to %s", result.Request.URL.String()) + } ret.Result = &result ret.ResourceID = &target.ResourceId }