mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Fix 'reading' of an empty history.
This commit is contained in:
@@ -131,6 +131,8 @@ void Histories::readInboxTill(
|
||||
not_null<History*> history,
|
||||
MsgId tillId,
|
||||
bool force) {
|
||||
Expects(IsServerMsgId(tillId) || (!tillId && !force));
|
||||
|
||||
if (!history->readInboxTillNeedsRequest(tillId) && !force) {
|
||||
return;
|
||||
} else if (!force) {
|
||||
@@ -202,7 +204,9 @@ void Histories::sendReadRequests() {
|
||||
const auto now = crl::now();
|
||||
auto next = std::optional<crl::time>();
|
||||
for (auto &[history, state] : _states) {
|
||||
if (state.readTill && state.readWhen <= now) {
|
||||
if (!state.readTill) {
|
||||
continue;
|
||||
} else if (state.readWhen <= now) {
|
||||
sendReadRequest(history, state);
|
||||
} else if (!next || *next > state.readWhen) {
|
||||
next = state.readWhen;
|
||||
|
Reference in New Issue
Block a user