diff --git a/WordPress/Classes/ViewRelated/Media/Tenor/TenorPageable.swift b/WordPress/Classes/ViewRelated/Media/Tenor/TenorPageable.swift index 853801006a62..dd9f0ba2e2c0 100644 --- a/WordPress/Classes/ViewRelated/Media/Tenor/TenorPageable.swift +++ b/WordPress/Classes/ViewRelated/Media/Tenor/TenorPageable.swift @@ -9,7 +9,16 @@ struct TenorPageable: Pageable { static let defaultPosition: String? = nil func next() -> Pageable? { - guard position != nil else { + guard let position = position, + let currentPosition = Int(position) else { + return nil + } + + // If the last page is not full, there is no more to load (thus there is no next). + let totalPossibleResults = (currentPageIndex + 1) * itemsPerPage + let remainingPageSpace = totalPossibleResults - currentPosition + + if remainingPageSpace < itemsPerPage { return nil }