diff --git a/Modio/Clients/SearchClient.cs b/Modio/Clients/SearchClient.cs index e209d9b..a82fde4 100644 --- a/Modio/Clients/SearchClient.cs +++ b/Modio/Clients/SearchClient.cs @@ -79,7 +79,8 @@ public async IAsyncEnumerable ToEnumerable() public async IAsyncEnumerable> ToPagedEnumerable() { var (method, path) = this.route; - uint? remaining = null; + // Huge integer type that does signed arithmetic and encompasses uint's max value + long? remaining = null; do { var req = new Request(method, path); @@ -93,6 +94,10 @@ public async IAsyncEnumerable> ToPagedEnumerable() remaining ??= result.Total; remaining -= result.Count; + // Don't bother returning anything or continuing for an empty response + if (result.Count == 0) + yield break; + var limit = result.Limit; var offset = result.Offset;