Fix viewing polls with no voters_count key

https://estrogen.network/@froggo/9igjsqqhxhsgtu4q
This commit is contained in:
blankie 2023-12-02 10:58:23 +11:00
parent 22dbe626b1
commit d146ec3498
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ void from_json(const json& j, Poll& poll) {
poll.expires_at = -1; poll.expires_at = -1;
} }
j.at("expired").get_to(poll.expired); 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); j.at("voters_count").get_to(poll.voters_count);
} else { } else {
poll.voters_count = -1; poll.voters_count = -1;