diff --git a/engine/spls_highestcost.go b/engine/spls_highestcost.go
index 82afdd49e..a59c431e6 100755
--- a/engine/spls_highestcost.go
+++ b/engine/spls_highestcost.go
@@ -19,6 +19,8 @@ along with this program. If not, see
package engine
import (
+ "fmt"
+
"github.com/cgrates/cgrates/utils"
)
@@ -39,6 +41,12 @@ func (hcs *HightCostSorter) SortSuppliers(prflID string, suppls []*Supplier,
Sorting: hcs.sorting,
SortedSuppliers: make([]*SortedSupplier, 0)}
for _, s := range suppls {
+ if len(s.RatingPlanIDs) == 0 {
+ utils.Logger.Warning(
+ fmt.Sprintf("<%s> RatingPlanIDs is empty for suplier with ID: %s",
+ utils.SupplierS, s.ID))
+ return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs")
+ }
if srtSpl, pass, err := hcs.spS.populateSortingData(ev, s, extraOpts); err != nil {
return nil, err
} else if pass && srtSpl != nil {
diff --git a/engine/spls_leastcost.go b/engine/spls_leastcost.go
index 5d5d386cc..740ab66f4 100644
--- a/engine/spls_leastcost.go
+++ b/engine/spls_leastcost.go
@@ -19,6 +19,8 @@ along with this program. If not, see
package engine
import (
+ "fmt"
+
"github.com/cgrates/cgrates/utils"
)
@@ -39,6 +41,12 @@ func (lcs *LeastCostSorter) SortSuppliers(prflID string, suppls []*Supplier,
Sorting: lcs.sorting,
SortedSuppliers: make([]*SortedSupplier, 0)}
for _, s := range suppls {
+ if len(s.RatingPlanIDs) == 0 {
+ utils.Logger.Warning(
+ fmt.Sprintf("<%s> RatingPlanIDs is empty for suplier with ID: %s",
+ utils.SupplierS, s.ID))
+ return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs")
+ }
if srtSpl, pass, err := lcs.spS.populateSortingData(ev, s, extraOpts); err != nil {
return nil, err
} else if pass && srtSpl != nil {