mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Fix assertion violation in History::inboxRead().
This commit is contained in:
@@ -1495,6 +1495,9 @@ void History::addToSharedMedia(
|
||||
}
|
||||
|
||||
std::optional<int> History::countUnread(MsgId upTo) const {
|
||||
if (!folderKnown() || !loadedAtBottom()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
auto result = 0;
|
||||
for (auto i = blocks.cend(), e = blocks.cbegin(); i != e;) {
|
||||
--i;
|
||||
@@ -1568,7 +1571,7 @@ void History::inboxRead(MsgId upTo, std::optional<int> stillUnread) {
|
||||
if (unreadCount() > 0 && loadedAtBottom()) {
|
||||
App::main()->historyToDown(this);
|
||||
}
|
||||
if (stillUnread) {
|
||||
if (stillUnread.has_value() && folderKnown()) {
|
||||
setUnreadCount(*stillUnread);
|
||||
} else if (const auto still = countUnread(upTo)) {
|
||||
setUnreadCount(*still);
|
||||
|
Reference in New Issue
Block a user