summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 10:30:33 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 10:30:33 +0300
commit03136db76ee7b60a3570f6c20c416ae9f53ec3ae (patch)
treeed7fd86b7cd1433dc56497eea7644115eeaf0133
parentc2528014a6c621dca9d46eb70a13db9038e8e5d0 (diff)
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.
-rw-r--r--internal/rpn/operations_metric.go3
1 files changed, 1 insertions, 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.