diff --git a/models.cpp b/models.cpp index a656a18..6e8dd2f 100644 --- a/models.cpp +++ b/models.cpp @@ -86,7 +86,7 @@ void from_json(const json& j, Poll& poll) { poll.expires_at = -1; } j.at("expired").get_to(poll.expired); - if (!j.at("voters_count").is_null()) { + if (j.contains("voters_count") && !j["voters_count"].is_null()) { j.at("voters_count").get_to(poll.voters_count); } else { poll.voters_count = -1;