From 2c7f5da8c6c116907951fd8a991e6335e729b7de Mon Sep 17 00:00:00 2001 From: Dmitry Vedenko Date: Thu, 1 Jul 2021 13:35:35 +0300 Subject: [PATCH] Fixes handling of invalid UpdateScheduledTime --- src/update/UpdateManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/update/UpdateManager.cpp b/src/update/UpdateManager.cpp index 96f520d23..f7637f4db 100644 --- a/src/update/UpdateManager.cpp +++ b/src/update/UpdateManager.cpp @@ -117,7 +117,7 @@ void UpdateManager::GetUpdates(bool ignoreNetworkErrors) wxString()); } } - }); + }); } }); } @@ -136,8 +136,11 @@ void UpdateManager::OnTimer(wxTimerEvent& WXUNUSED(event)) bool UpdateManager::IsTimeForUpdatesChecking() { + // We use atoll here, so there is no need to handle the exception, + // if prefsUpdateScheduledTime is corrupted. + // atoll will return 0 on failure, which suits us well. const TimePoint nextUpdatesCheckingTime(std::chrono::milliseconds( - stoll(gPrefs->Read(prefsUpdateScheduledTime, "0").ToStdString()))); + atoll(gPrefs->Read(prefsUpdateScheduledTime, "0").c_str()))); // Get current time const TimePoint currentTime = Clock::now();