diff --git a/models/resources/dynamic.go b/models/resources/dynamic.go index 99311bb..c3582b6 100755 --- a/models/resources/dynamic.go +++ b/models/resources/dynamic.go @@ -70,12 +70,16 @@ func (d *DynamicResource) SetAllowedInstances(request *tools.APIRequest, instanc } break } - sorted := make([]ResourceInstanceITF, len(d.Instances)) - copy(sorted, d.Instances) - slices.SortStableFunc(sorted, func(a, b ResourceInstanceITF) int { - d.SortRules["partnerships"] = "%v not contains 2" - return d.compareByRules(a, b, d.SortRules) - }) + if d.SortRules != nil { + sorted := make([]ResourceInstanceITF, len(d.Instances)) + copy(sorted, d.Instances) + slices.SortStableFunc(sorted, func(a, b ResourceInstanceITF) int { + d.SortRules["partnerships"] = "%v not contains 2" + return d.compareByRules(a, b, d.SortRules) + }) + d.Instances = sorted + } + d.WatchedDynamicResource = []string{} return d.Instances }