2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Fix crash when accessing a deleted item view.

This commit is contained in:
John Preston
2018-03-09 14:44:42 +03:00
parent 73c0c4507a
commit 6bd5301828
6 changed files with 34 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ int OnlinePhraseChangeInSeconds(TimeId online, TimeId now) {
if (-online > now) {
return (-online - now);
}
return std::numeric_limits<int32>::max();
return std::numeric_limits<TimeId>::max();
}
if (online > now) {
return online - now;
@@ -36,7 +36,7 @@ int OnlinePhraseChangeInSeconds(TimeId online, TimeId now) {
}
const auto nowFull = ParseDateTime(now);
const auto tomorrow = QDateTime(nowFull.date().addDays(1));
return static_cast<int32>(nowFull.secsTo(tomorrow));
return std::max(static_cast<TimeId>(nowFull.secsTo(tomorrow)), 0);
}
base::optional<QString> OnlineTextSpecial(not_null<UserData*> user) {