FIX: Redirect to homepage if no posts exist (PR #14951)

After permanently deleting the first post of a topic the user was sometimes stuck on the page because of an infinite loop. This problem happened more often in Firefox.

GitHub

This pull request has been mentioned on Discourse Meta. There might be relevant details there: