Skip to content

Commit

Permalink
Add condition to stop loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mzumi committed Dec 12, 2023
1 parent e207c4a commit ababe29
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public Iterable<GoogleAdsServiceClient.SearchPage> getReportPage()
SearchGoogleAdsRequest request = buildRequest(task, query);
GoogleAdsServiceClient googleAdsService = client.getVersion13().createGoogleAdsServiceClient();
GoogleAdsServiceClient.SearchPagedResponse response = googleAdsService.search(request);

if (response.getPage().getResponse().getResultsCount() == 0) {
return pages;
}

response.iteratePages().iterator().forEachRemaining(pages::add);

if (task.getResourceType().equals("change_event")) {
Expand Down

0 comments on commit ababe29

Please sign in to comment.