summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-20 12:58:51 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-20 12:58:51 +0300
commit5d2cf7ab60df00e500cf4983ea765e578496eb32 (patch)
treea07da7ce295a56539938e09d28487948bd51b2b1 /protocols
parent49129b23f64e79d46e10f53f01d6f52a2c731dfb (diff)
fixes #4214 ([Telegram] Crash)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/avatars.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp
index ec72252bdf..8751b744fd 100644
--- a/protocols/Telegram/src/avatars.cpp
+++ b/protocols/Telegram/src/avatars.cpp
@@ -181,8 +181,12 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj)
if (pFile == nullptr)
return;
+ auto *pRemote = pFile->remote_.get();
+ if (pRemote == nullptr)
+ return;
+
if (!pFile->local_->is_downloading_completed_) {
- if (auto *F = FindFile(pFile->remote_->unique_id_.c_str())) {
+ if (auto *F = FindFile(pRemote->unique_id_.c_str())) {
if (F->m_type != F->AVATAR && F->ofd) {
DBVARIANT dbv = { DBVT_DWORD };
dbv.dVal = pFile->local_->downloaded_size_;
@@ -194,7 +198,7 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj)
Utf2T wszExistingFile(pFile->local_->path_.c_str());
- if (auto *F = FindFile(pFile->remote_->unique_id_.c_str())) {
+ if (auto *F = FindFile(pRemote->unique_id_.c_str())) {
if (F->m_type == F->AVATAR) {
CMStringW wszFullName = F->m_destPath;
if (!wszFullName.IsEmpty())
@@ -265,10 +269,10 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj)
for (auto &it : m_arOwnMsg) {
if (it->tmpFileId == pFile->id_) {
- if (!pFile->remote_->id_.empty()) {
+ if (!pRemote->id_.empty()) {
if (auto hDbEvent = db_event_getById(m_szModuleName, it->szMsgId)) {
DBVARIANT dbv = { DBVT_UTF8 };
- dbv.pszVal = (char *)pFile->remote_->id_.c_str();
+ dbv.pszVal = (char *)pRemote->id_.c_str();
db_event_setJson(hDbEvent, "u", &dbv);
}
}
@@ -277,7 +281,7 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj)
}
for (auto &it : m_arUsers) {
- if (it->szAvatarHash == pFile->remote_->unique_id_.c_str()) {
+ if (it->szAvatarHash == pRemote->unique_id_.c_str()) {
PROTO_AVATAR_INFORMATION pai;
pai.hContact = it->hContact;
pai.format = ProtoGetAvatarFileFormat(wszExistingFile);