From 03136db76ee7b60a3570f6c20c416ae9f53ec3ae Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 10:30:33 +0300 Subject: rpn: use GetCoolMetric() instead of ignored-error Find("Cool") resultMetricForAdd silently ignored the error from GetMetricRegistry().Find("Cool"), which could propagate a nil *Metric if Cool were absent, risking nil pointer dereference. Replace with GetCoolMetric() which is guaranteed non-nil. --- internal/rpn/operations_metric.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/rpn/operations_metric.go b/internal/rpn/operations_metric.go index a9f91cc..4809ce1 100644 --- a/internal/rpn/operations_metric.go +++ b/internal/rpn/operations_metric.go @@ -50,8 +50,7 @@ func resultMetricForAdd(metrics []*Metric) *Metric { if len(metrics) > 0 && metrics[0] != nil { return metrics[0] } - m, _ := GetMetricRegistry().Find("Cool") - return m + return GetCoolMetric() } // categoriesCompatible checks if two metrics are compatible for arithmetic. -- cgit v1.2.3