Fix viewing polls with no voters_count key
https://estrogen.network/@froggo/9igjsqqhxhsgtu4q
This commit is contained in:
parent
22dbe626b1
commit
d146ec3498
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue