From bdc275a92709691c8c4e654c47b2f4135d8c17c1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 25 Aug 2021 15:18:47 +0300 Subject: [PATCH] Don't crash on bad userId in local storage. --- Telegram/SourceFiles/main/main_account.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Telegram/SourceFiles/main/main_account.cpp b/Telegram/SourceFiles/main/main_account.cpp index 93ab7f99a..4eb4dbe17 100644 --- a/Telegram/SourceFiles/main/main_account.cpp +++ b/Telegram/SourceFiles/main/main_account.cpp @@ -153,6 +153,12 @@ void Account::createSession( const auto flags = MTPDuser::Flag::f_self | (phone.isEmpty() ? MTPDuser::Flag() : MTPDuser::Flag::f_phone); + + using ServerUserIdType = decltype(std::declval().vid().v); + if (ServerUserIdType(id.bare) <= 0) { // #TODO ids remove + return; + } + createSession( MTP_user( MTP_flags(flags),