From e4399413c115f7273d7a09628bf3e91d846afa55 Mon Sep 17 00:00:00 2001 From: "CTFang@WireLab" Date: Fri, 22 Mar 2024 09:09:28 +0000 Subject: [PATCH] fix: error handling in RatingFunction --- pkg/rf/rating.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/rf/rating.go b/pkg/rf/rating.go index d40fb32..44b74ae 100644 --- a/pkg/rf/rating.go +++ b/pkg/rf/rating.go @@ -162,7 +162,11 @@ func handleSUR() diam.HandlerFunc { if err != nil { logger.ChargingdataPostLog.Errorf("Get tarrif error: %+v", err) } - + if chargingInterface == nil { + logger.ChargingdataPostLog.Warningf( + "No ChargingData found for UE:[%+v] for RG:[%+v]", subscriberId, rg) + return + } unitCostStr := chargingInterface["unitCost"].(string) monetaryTariff := buildTaffif(unitCostStr) unitCost := datatype.Unsigned32(monetaryTariff.RateElement.UnitCost.ValueDigits) *