From 3f8e822621ad3713ca3883eb07ef6ec22c53a7e0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 27 Feb 2017 21:25:42 +0300 Subject: [PATCH] Fixing crash in logout from passcode. If the MTP::Instance is not started yet (we forgot our passcode), the logout attempt was attempting to use mtproto from Intro::Widget constructor before it was created. Now we create it before logout. --- Telegram/SourceFiles/app.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index a9fde250f..95467aae3 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -229,8 +229,10 @@ namespace { if (auto mtproto = Messenger::Instance().mtp()) { mtproto->logout(rpcDone(&loggedOut), rpcFail(&loggedOut)); } else { - loggedOut(); + // We log out because we've forgotten passcode. + // So we just start mtproto from scratch. Messenger::Instance().startMtp(); + loggedOut(); } }