diff --git a/models.cpp b/models.cpp index 022e1b9..21aa93a 100644 --- a/models.cpp +++ b/models.cpp @@ -74,8 +74,9 @@ void from_json(const json& j, Media& media) { if (!j.at("remote_url").is_null()) { media.remote_url = j["remote_url"].get(); } - if (media.type == "image" || media.type == "video" || media.type == "gifv") { - const json& meta = j.at("meta"); + // .contains() check: https://social.platypus-sandbox.com/@ashten/AcPl5zVFxeGu7eSKSe + if (j.contains("meta") && (media.type == "image" || media.type == "video" || media.type == "gifv")) { + const json& meta = j["meta"]; media.size = meta.at("original").get(); media.preview_size = meta.at("small").get(); }