Fix "key 'meta' not found"
https://social.platypus-sandbox.com/@ashten/AcPl5zVFxeGu7eSKSe
This commit is contained in:
parent
a581c9cc3c
commit
881082f236
|
@ -74,8 +74,9 @@ void from_json(const json& j, Media& media) {
|
||||||
if (!j.at("remote_url").is_null()) {
|
if (!j.at("remote_url").is_null()) {
|
||||||
media.remote_url = j["remote_url"].get<std::string>();
|
media.remote_url = j["remote_url"].get<std::string>();
|
||||||
}
|
}
|
||||||
if (media.type == "image" || media.type == "video" || media.type == "gifv") {
|
// .contains() check: https://social.platypus-sandbox.com/@ashten/AcPl5zVFxeGu7eSKSe
|
||||||
const json& meta = j.at("meta");
|
if (j.contains("meta") && (media.type == "image" || media.type == "video" || media.type == "gifv")) {
|
||||||
|
const json& meta = j["meta"];
|
||||||
media.size = meta.at("original").get<Size>();
|
media.size = meta.at("original").get<Size>();
|
||||||
media.preview_size = meta.at("small").get<Size>();
|
media.preview_size = meta.at("small").get<Size>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue