2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Ensure notification manager is not null before first call to setManager in cross-platform code

This commit is contained in:
Ilya Fedin
2022-07-26 06:54:18 +04:00
committed by John Preston
parent 6718d238af
commit 9b8dcec26e
3 changed files with 12 additions and 25 deletions

View File

@@ -91,7 +91,8 @@ System::NotificationInHistoryKey::NotificationInHistoryKey(
System::System()
: _waitTimer([=] { showNext(); })
, _waitForAllGroupedTimer([=] { showGrouped(); }) {
, _waitForAllGroupedTimer([=] { showGrouped(); })
, _manager(std::make_unique<DummyManager>(this)) {
settingsChanged(
) | rpl::start_with_next([=](ChangeType type) {
if (type == ChangeType::DesktopEnabled) {
@@ -116,11 +117,9 @@ void System::setManager(std::unique_ptr<Manager> manager) {
}
}
std::optional<ManagerType> System::managerType() const {
if (_manager) {
return _manager->type();
}
return std::nullopt;
ManagerType System::managerType() const {
Expects(_manager != nullptr);
return _manager->type();
}
Main::Session *System::findSession(uint64 sessionId) const {