summaryrefslogtreecommitdiff
path: root/src/TgTypeParser.cpp
diff options
context:
space:
mode:
authorray-pixar <pixar@chmail.ir>2015-09-10 19:19:15 +0430
committerray-pixar <pixar@chmail.ir>2015-09-10 19:19:15 +0430
commit6bb048c991a52c0b974bd4a316579f0a622a70ec (patch)
treea46258645f3647431c60379335d217445a22ab81 /src/TgTypeParser.cpp
parenta4954856e680b85eebdcfa5dddf5c9baf8102077 (diff)
Fix for send files using multipart/form
Diffstat (limited to 'src/TgTypeParser.cpp')
-rw-r--r--src/TgTypeParser.cpp12
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;