|
@@ -49,12 +49,18 @@ void copy(MessageContent &content, rapidjson::Value &mem)
|
|
|
content.set_content(mem["content"].GetString());
|
|
|
if (mem.HasMember("binaryContent"))
|
|
|
{
|
|
|
- auto bin = mem["binaryContent"].GetString();
|
|
|
- int len = base64DecodeLength(bin, strlen(bin));
|
|
|
- uint8_t *cbytes = new uint8_t[len + 1];
|
|
|
- size_t retLen = base64Decode(cbytes, len, (const uint8_t*)bin, strlen(bin));
|
|
|
- content.set_data(cbytes, retLen);
|
|
|
- delete[] cbytes;
|
|
|
+ auto bin = mem["binaryContent"].GetString();
|
|
|
+ if (bin != nullptr)
|
|
|
+ {
|
|
|
+ int len = base64DecodeLength(bin, strlen(bin));
|
|
|
+ if (len > 0)
|
|
|
+ {
|
|
|
+ uint8_t *cbytes = new uint8_t[len + 1];
|
|
|
+ size_t retLen = base64Decode(cbytes, len, (const uint8_t *)bin, strlen(bin));
|
|
|
+ content.set_data(cbytes, retLen);
|
|
|
+ delete[] cbytes;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (mem.HasMember("mediaType"))
|
|
|
content.set_mediatype(mem["mediaType"].GetInt());
|