updateCurrentUnread: don't crash if counter element is not available

This commit is contained in:
Andrew Dolgov 2019-12-17 14:06:50 +03:00
parent 9f70bb010a
commit f83836ade9
1 changed files with 8 additions and 6 deletions

View File

@ -547,13 +547,15 @@ define(["dojo/_base/declare"], function (declare) {
return tmp.firstChild;
},
updateCurrentUnread: function() {
const feed_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat());
if ($("feed_current_unread")) {
const feed_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat());
if (feed_unread > 0 && !Element.visible("feeds-holder")) {
$("feed_current_unread").innerText = feed_unread;
Element.show("feed_current_unread");
} else {
Element.hide("feed_current_unread");
if (feed_unread > 0 && !Element.visible("feeds-holder")) {
$("feed_current_unread").innerText = feed_unread;
Element.show("feed_current_unread");
} else {
Element.hide("feed_current_unread");
}
}
},
onLoaded: function (transport, offset, append) {