diff options
author | George Hazan <george.hazan@gmail.com> | 2024-10-12 21:03:45 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-10-12 21:03:45 +0300 |
commit | 2f112b300d2c5582b9a614ce3588d6d6879bcd1c (patch) | |
tree | a22e1cac3e346f12f8bcb032ab30892ffdf4698e /protocols | |
parent | 007cece71aebe64dafc824894270e4661416dcfc (diff) |
Telegram: fix for occasional crash
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 627e11eda5..9ef0809d38 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -738,15 +738,21 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg }
if (m_bSmileyAdd) {
- const char *pwszFileExt;
- switch (pSticker->format_->get_id()) {
- case TD::stickerFormatTgs::ID: pwszFileExt = "tga"; break;
- case TD::stickerFormatWebm::ID: pwszFileExt = "webm"; break;
- case TD::stickerFormatWebp::ID: pwszFileExt = "webp"; break;
- default:pwszFileExt = "jpeg"; break;
+ if (pSticker->thumbnail_.get()) {
+ const char *pwszFileExt;
+ switch (pSticker->format_->get_id()) {
+ case TD::stickerFormatTgs::ID: pwszFileExt = "tga"; break;
+ case TD::stickerFormatWebm::ID: pwszFileExt = "webm"; break;
+ case TD::stickerFormatWebp::ID: pwszFileExt = "webp"; break;
+ default:
+ pwszFileExt = "jpeg"; break;
+ }
+ ret = GetMessageSticker(pSticker->thumbnail_->file_.get(), pwszFileExt);
+ }
+ else {
+ debugLogA("Strange sticker without preview");
+ ret.Append(pSticker->emoji_.c_str());
}
-
- ret = GetMessageSticker(pSticker->thumbnail_->file_.get(), pwszFileExt);
}
else ret.AppendFormat("%s: %s", TranslateU("SmileyAdd plugin required to support stickers"), pSticker->emoji_.c_str());
}
|