mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Fix assertion violation in History::inboxRead().
This commit is contained in:
parent
0b26475300
commit
ca548a11d7
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue