Fix nil pointer on timespans which are not paid

This commit is contained in:
DanB
2014-08-05 23:24:20 +02:00
parent 0a6f0ab0c7
commit 514df9a489

View File

@@ -150,7 +150,7 @@ func (cc *CallCost) ToDataCost() (*DataCost, error) {
func (cc *CallCost) GetLongestRounding() (roundingDecimals int, roundingMethod string) {
for _, ts := range cc.Timespans {
if ts.RateInterval.Rating.RoundingDecimals > roundingDecimals {
if ts.RateInterval != nil && ts.RateInterval.Rating.RoundingDecimals > roundingDecimals { //ToDo: When will ts.RateInterval be empty?
roundingDecimals = ts.RateInterval.Rating.RoundingDecimals
roundingMethod = ts.RateInterval.Rating.RoundingMethod
}