Skip to content

Commit

Permalink
fix: #12502, improper decrement
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Apr 12, 2024
1 parent 64258da commit 6befff5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/topics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Topics.search = async function (tid, term) {
Topics.getPidByIndex = async function (tid, index) {
index -= 2; // zset only stores replies, index is not zero-indexed, so offset by 2.
return index > 0 ?
(await db.getSortedSetRange(`tid:${tid}:posts`, index - 2, index - 2)).pop() :
(await db.getSortedSetRange(`tid:${tid}:posts`, index, index)).pop() :
await Topics.getTopicField(tid, 'mainPid');
};

Expand Down

0 comments on commit 6befff5

Please sign in to comment.