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() {
return (Messenger::Instance().authSession() != nullptr);
if (auto messenger = Messenger::InstancePointer()) {
return (messenger->authSession() != nullptr);
}
return false;
}
AuthSession &AuthSession::Current() {

View File

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