diff options
Diffstat (limited to 'src/TgTypeParser.cpp')
-rw-r--r-- | src/TgTypeParser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 81d2119..d4f4340 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -187,7 +187,9 @@ string TgTypeParser::parseAudio(const Audio::Ptr& object) const { Document::Ptr TgTypeParser::parseJsonAndGetDocument(const ptree& data) const { Document::Ptr result(new Document); result->fileId = data.get<string>("file_id"); - result->thumb = parseJsonAndGetPhotoSize(data.find("thumb")->second); + if(data.find("thumb") != data.not_found()) { + result->thumb = parseJsonAndGetPhotoSize(data.find("thumb")->second); + } result->fileName = data.get("file_name", ""); result->mimeType = data.get("mime_type", ""); result->fileSize = data.get("file_size", 0); @@ -215,7 +217,9 @@ Sticker::Ptr TgTypeParser::parseJsonAndGetSticker(const ptree& data) const { result->fileId = data.get<string>("file_id"); result->width = data.get<int32_t>("width"); result->height = data.get<int32_t>("height"); - result->thumb = parseJsonAndGetPhotoSize(data.find("thumb")->second); + if(data.find("thumb") != data.not_found()) { + result->thumb = parseJsonAndGetPhotoSize(data.find("thumb")->second); + } result->fileSize = data.get("file_size", 0); return result; } @@ -242,7 +246,9 @@ Video::Ptr TgTypeParser::parseJsonAndGetVideo(const ptree& data) const { result->width = data.get<int32_t>("width"); result->height = data.get<int32_t>("height"); result->duration = data.get<int32_t>("duration"); - result->thumb = parseJsonAndGetPhotoSize(data.find("thumb")->second); + if(data.find("thumb") != data.not_found()) { + result->thumb = parseJsonAndGetPhotoSize(data.find("thumb")->second); + } result->mimeType = data.get("mime_type", ""); result->fileSize = data.get("file_size", 0); return result; |