Skip to content

Commit

Permalink
fix: range bug on .find() for nested replies
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Apr 20, 2023
1 parent 3356a8c commit 4e9dcc2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/fourchan/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (post *Post) find(needlePostId, depth int) (*Post, int) {
if post.id == needlePostId {
return post, depth
}
for _, reply := range post.replies {
foundPost, newDepth := reply.find(needlePostId, depth+1)
for i := range post.replies {
foundPost, newDepth := post.replies[i].find(needlePostId, depth+1)
if foundPost != nil {
return foundPost, newDepth
}
Expand Down

0 comments on commit 4e9dcc2

Please sign in to comment.