Fix crash in AuthSession::Exists() if there is no Messenger.

Also use toggleAnimated instead of show/hideAnimated in intro.
This commit is contained in:
John Preston 2017-04-14 15:12:40 +03:00
parent bf0bf908c2
commit bc7139d67a
2 changed files with 10 additions and 15 deletions

View File

@ -93,7 +93,10 @@ AuthSession::AuthSession(UserId userId)
} }
bool AuthSession::Exists() { bool AuthSession::Exists() {
return (Messenger::Instance().authSession() != nullptr); if (auto messenger = Messenger::InstancePointer()) {
return (messenger->authSession() != nullptr);
}
return false;
} }
AuthSession &AuthSession::Current() { AuthSession &AuthSession::Current() {

View File

@ -153,20 +153,12 @@ void Widget::historyMove(Direction direction) {
if (direction == Direction::Back || direction == Direction::Replace) { if (direction == Direction::Back || direction == Direction::Replace) {
delete base::take(wasStep); delete base::take(wasStep);
} }
if (getStep()->hasBack()) { _back->toggleAnimated(getStep()->hasBack());
_back->showAnimated();
} else { auto stepHasCover = getStep()->hasCover();
_back->hideAnimated(); _settings->toggleAnimated(!stepHasCover);
} if (_update) _update->toggleAnimated(!stepHasCover);
if (getStep()->hasCover()) { if (_changeLanguage) _changeLanguage->toggleAnimated(stepHasCover);
_settings->hideAnimated();
if (_update) _update->hideAnimated();
if (_changeLanguage) _changeLanguage->showAnimated();
} else {
_settings->showAnimated();
if (_update) _update->showAnimated();
if (_changeLanguage) _changeLanguage->hideAnimated();
}
_next->setText(getStep()->nextButtonText()); _next->setText(getStep()->nextButtonText());
if (_resetAccount) _resetAccount->hideAnimated(); if (_resetAccount) _resetAccount->hideAnimated();
getStep()->showAnimated(direction); getStep()->showAnimated(direction);