summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-30 15:54:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-30 15:54:11 +0300
commit24526b6f09a5eeba1ffdeee42f003e056a974056 (patch)
tree7b7d6f3a77f32a430fd727853b8618ad7b3403db /protocols/Telegram/src
parente009ecfc26e8884f8216ae77b5af580d5d74e83c (diff)
possible crash fix
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/groupchat.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp
index 48decfea3b..eee14c00cd 100644
--- a/protocols/Telegram/src/groupchat.cpp
+++ b/protocols/Telegram/src/groupchat.cpp
@@ -47,29 +47,30 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat)
}
}
else {
- si = Chat_NewSession(GCW_CHANNEL, m_szModuleName, wszId, wszNick, pUser);
- if (!si->pStatuses) {
- Chat_AddGroup(si, TranslateT("SuperAdmin"));
- Chat_AddGroup(si, TranslateT("Visitor"));
-
- ptrW wszMyId(getWStringA(DBKEY_ID)), wszMyNick(Contact::GetInfo(CNF_DISPLAY, 0, m_szModuleName));
+ if (si = Chat_NewSession(GCW_CHANNEL, m_szModuleName, wszId, wszNick, pUser)) {
+ if (!si->pStatuses) {
+ Chat_AddGroup(si, TranslateT("SuperAdmin"));
+ Chat_AddGroup(si, TranslateT("Visitor"));
+
+ ptrW wszMyId(getWStringA(DBKEY_ID)), wszMyNick(Contact::GetInfo(CNF_DISPLAY, 0, m_szModuleName));
+
+ GCEVENT gce = { si, GC_EVENT_JOIN };
+ gce.pszUID.w = wszMyId;
+ gce.pszNick.w = wszMyNick;
+ gce.bIsMe = true;
+ gce.pszStatus.w = TranslateT("Visitor");
+ Chat_Event(&gce);
+
+ gce.bIsMe = false;
+ gce.pszUID.w = wszId;
+ gce.pszNick.w = wszNick;
+ gce.pszStatus.w = TranslateT("SuperAdmin");
+ Chat_Event(&gce);
+ }
- GCEVENT gce = { si, GC_EVENT_JOIN };
- gce.pszUID.w = wszMyId;
- gce.pszNick.w = wszMyNick;
- gce.bIsMe = true;
- gce.pszStatus.w = TranslateT("Visitor");
- Chat_Event(&gce);
-
- gce.bIsMe = false;
- gce.pszUID.w = wszId;
- gce.pszNick.w = wszNick;
- gce.pszStatus.w = TranslateT("SuperAdmin");
- Chat_Event(&gce);
+ Chat_Control(si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
+ Chat_Control(si, SESSION_ONLINE);
}
-
- Chat_Control(si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
- Chat_Control(si, SESSION_ONLINE);
}
pUser->m_si = si;