summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/proto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r--protocols/Telegram/src/proto.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 355d137256..17c8e04cb7 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -184,13 +184,18 @@ void CTelegramProto::OnShutdown()
int CTelegramProto::OnWindowEvent(WPARAM wParam, LPARAM lParam)
{
- if (wParam == MSG_WINDOW_EVT_OPENING) {
- auto *pDlg = (CMsgDialog *)lParam;
- if (Proto_IsProtoOnContact(pDlg->m_hContact, m_szModuleName))
- if (auto *pUser = FindUser(GetId(pDlg->m_hContact)))
- if (pUser->chatId == -1 && !pDlg->isChat())
- SendQuery(new TD::createPrivateChat(pUser->id, true));
- }
+ auto *pDlg = (CMsgDialog *)lParam;
+ if (!Proto_IsProtoOnContact(pDlg->m_hContact, m_szModuleName))
+ return 0;
+
+ auto *pUser = FindUser(GetId(pDlg->m_hContact));
+ if (pUser == nullptr)
+ return 0;
+
+ if (wParam == MSG_WINDOW_EVT_OPENING)
+ if (pUser->chatId == -1 && !pDlg->isChat())
+ SendQuery(new TD::createPrivateChat(pUser->id, true));
+
return 0;
}