mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
add extra safety so offset can not be negative
This commit is contained in:
parent
9981257880
commit
c02f1b026a
1 changed files with 3 additions and 1 deletions
|
@ -170,7 +170,9 @@ class TopicQuery
|
||||||
if page == 0
|
if page == 0
|
||||||
(pinned_topics + unpinned_topics)[0...limit] if limit
|
(pinned_topics + unpinned_topics)[0...limit] if limit
|
||||||
else
|
else
|
||||||
unpinned_topics.offset((page * per_page - pinned_topics.count) - 1).to_a
|
offset = (page * per_page - pinned_topics.count) - 1
|
||||||
|
offset = 0 unless offset > 0
|
||||||
|
unpinned_topics.offset(offset).to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue