From 6bb048c991a52c0b974bd4a316579f0a622a70ec Mon Sep 17 00:00:00 2001 From: ray-pixar Date: Thu, 10 Sep 2015 19:19:15 +0430 Subject: Fix for send files using multipart/form --- src/TgTypeParser.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/TgTypeParser.cpp') 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("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("file_id"); result->width = data.get("width"); result->height = data.get("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("width"); result->height = data.get("height"); result->duration = data.get("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; -- cgit v1.2.3