diff options
author | George Hazan <george.hazan@gmail.com> | 2023-06-29 16:57:20 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-06-29 16:57:20 +0300 |
commit | 907696b103b6e25721dfb543e5f85c43f69929f9 (patch) | |
tree | cdf420453a628e46b6a15fde74c9c110cc93e819 /protocols | |
parent | 9f074e2af4cadede0c654d8e6115f90ff6cb0176 (diff) |
Telegram: fix for occasional crash
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index d646e96123..a317ff2d21 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -426,24 +426,26 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg case TD::messageAnimatedEmoji::ID:
if (m_bSmileyAdd) {
- auto *pSticker = ((TD::messageAnimatedEmoji *)pBody)->animated_emoji_->sticker_.get();
- if (!checkStickerType(pSticker->full_type_->get_id())) {
- debugLogA("You received a sticker of unsupported type %d, ignored", pSticker->full_type_->get_id());
- break;
+ if (auto *pAnimated = ((TD::messageAnimatedEmoji *)pBody)->animated_emoji_.get()) {
+ auto *pSticker = pAnimated->sticker_.get();
+ if (!checkStickerType(pSticker->full_type_->get_id())) {
+ debugLogA("You received a sticker of unsupported type %d, ignored", pSticker->full_type_->get_id());
+ break;
+ }
+
+ const char *pwszFileExt;
+ switch (pSticker->thumbnail_->format_->get_id()) {
+ case TD::thumbnailFormatGif::ID: pwszFileExt = "gif"; break;
+ case TD::thumbnailFormatPng::ID: pwszFileExt = "png"; break;
+ case TD::thumbnailFormatTgs::ID: pwszFileExt = "tga"; break;
+ case TD::thumbnailFormatJpeg::ID: pwszFileExt = "jpg"; break;
+ case TD::thumbnailFormatWebm::ID: pwszFileExt = "webm"; break;
+ case TD::thumbnailFormatWebp::ID: pwszFileExt = "webp"; break;
+ default:pwszFileExt = "jpeg"; break;
+ }
+
+ return GetMessageSticker(pSticker->thumbnail_->file_.get(), pwszFileExt);
}
-
- const char *pwszFileExt;
- switch (pSticker->thumbnail_->format_->get_id()) {
- case TD::thumbnailFormatGif::ID: pwszFileExt = "gif"; break;
- case TD::thumbnailFormatPng::ID: pwszFileExt = "png"; break;
- case TD::thumbnailFormatTgs::ID: pwszFileExt = "tga"; break;
- case TD::thumbnailFormatJpeg::ID: pwszFileExt = "jpg"; break;
- case TD::thumbnailFormatWebm::ID: pwszFileExt = "webm"; break;
- case TD::thumbnailFormatWebp::ID: pwszFileExt = "webp"; break;
- default:pwszFileExt = "jpeg"; break;
- }
-
- return GetMessageSticker(pSticker->thumbnail_->file_.get(), pwszFileExt);
}
break;
|