Skip to content

Commit bbfa328

Browse files
authored
Merge pull request #21 from czf/patch-1
LimitPerRequest was ignored
2 parents 8a6fd5b + e8c864f commit bbfa328

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

RedditSharp/Listing.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,20 @@ private void PageBack()
201201
if (LimitPerRequest != -1)
202202
{
203203
int limit = LimitPerRequest;
204-
205-
if (limit > MaximumLimit)
206-
{
207-
// If the limit is more than the maximum number of listings, adjust
208-
limit = MaximumLimit;
209-
}
210-
else if (Count + limit > MaximumLimit)
204+
if(MaximumLimit != -1)
211205
{
212-
// If a smaller subset of listings are needed, adjust the limit
213-
limit = MaximumLimit - Count;
206+
if (limit > MaximumLimit)
207+
{
208+
// If the limit is more than the maximum number of listings, adjust
209+
limit = MaximumLimit;
210+
}
211+
else if (Count + limit > MaximumLimit)
212+
{
213+
// If a smaller subset of listings are needed, adjust the limit
214+
limit = MaximumLimit - Count;
215+
}
214216
}
215-
217+
216218
if (limit > 0)
217219
{
218220
// Add the limit, the maximum number of items to be returned per page

0 commit comments

Comments
 (0)