@@ -21,12 +21,14 @@ func (actor Actor) ResourceMatch(resources []sharedaction.V3Resource) ([]shareda
2121 )
2222
2323 for _ , chunk := range resourceChunks {
24- newMatchedAPIResources , warnings , err := actor .CloudControllerClient .ResourceMatch (chunk )
25- allWarnings = append (allWarnings , warnings ... )
26- if err != nil {
27- return nil , allWarnings , err
24+ if len (chunk ) > 0 {
25+ newMatchedAPIResources , warnings , err := actor .CloudControllerClient .ResourceMatch (chunk )
26+ allWarnings = append (allWarnings , warnings ... )
27+ if err != nil {
28+ return nil , allWarnings , err
29+ }
30+ matchedAPIResources = append (matchedAPIResources , newMatchedAPIResources ... )
2831 }
29- matchedAPIResources = append (matchedAPIResources , newMatchedAPIResources ... )
3032 }
3133
3234 var matchedResources []sharedaction.V3Resource
@@ -51,8 +53,10 @@ func (Actor) chunkResources(resources []sharedaction.V3Resource) [][]ccv3.Resour
5153 }
5254
5355 if len (currentSet ) == constant .MaxNumberOfResourcesForMatching || index + 1 == len (resources ) {
54- chunkedResources = append (chunkedResources , currentSet )
55- currentSet = []ccv3.Resource {}
56+ if len (currentSet ) > 0 {
57+ chunkedResources = append (chunkedResources , currentSet )
58+ currentSet = []ccv3.Resource {}
59+ }
5660 }
5761 }
5862 return chunkedResources
0 commit comments