fix: crash if unreadTopics is undefined

This commit is contained in:
Barış Soner Uşaklı
2021-03-13 09:16:26 -05:00
parent 5b0d068ccd
commit 617f4730a0

View File

@@ -129,7 +129,7 @@ define('forum/unread', [
var unreadTopics = app.user.unreadData;
function onNewPost(data) {
if (data && data.posts && data.posts.length) {
if (data && data.posts && data.posts.length && unreadTopics) {
var post = data.posts[0];
if (parseInt(post.uid, 10) === parseInt(app.user.uid, 10) ||
(!post.topic.isFollowing && post.categoryWatchState !== watchStates.watching)