From 8202a1633b2cfb4144936971bef31292b204a69b Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 5 Jul 2017 21:45:46 +0300 Subject: [PATCH] Fix crash in single instance forcing. Local server communication is allowed before Messenger constructor. --- Telegram/SourceFiles/application.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index c72829863..c280e4347 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -242,6 +242,7 @@ void Application::newInstanceConnected() { } void Application::readClients() { + // This method can be called before Messenger is constructed. QString startUrl; QStringList toSend; for (LocalClients::iterator i = _localClients.begin(), e = _localClients.end(); i != e; ++i) { @@ -286,7 +287,9 @@ void Application::readClients() { if (!startUrl.isEmpty()) { cSetStartUrl(startUrl); } - Messenger::Instance().checkStartUrl(); + if (auto messenger = Messenger::InstancePointer()) { + messenger->checkStartUrl(); + } } void Application::removeClients() {