From 90ecec1d2e7d6e8a4c4c9fd1e3b77dfcb70ae274 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 17 Jun 2019 14:19:19 +0200 Subject: [PATCH] Add more assertions in online update. --- Telegram/SourceFiles/mainwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 812543c38..c30b5ed38 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -3535,6 +3535,7 @@ void MainWidget::updateOnline(bool gotOtherOffline) { bool isOnline = !App::quitting() && App::wnd()->isActive(); int updateIn = Global::OnlineUpdatePeriod(); + Assert(updateIn >= 0); if (isOnline) { const auto idle = crl::now() - Core::App().lastNonIdleTime(); if (idle >= Global::OfflineIdleTimeout()) { @@ -3545,6 +3546,7 @@ void MainWidget::updateOnline(bool gotOtherOffline) { } } else { updateIn = qMin(updateIn, int(Global::OfflineIdleTimeout() - idle)); + Assert(updateIn >= 0); } } auto ms = crl::now(); @@ -3579,6 +3581,7 @@ void MainWidget::updateOnline(bool gotOtherOffline) { _lastSetOnline = ms; } else if (isOnline) { updateIn = qMin(updateIn, int(_lastSetOnline + Global::OnlineUpdatePeriod() - ms)); + Assert(updateIn >= 0); } _onlineTimer.callOnce(updateIn); }