From d146ec3498faa735166587ed4b7f2662b3d3b51c Mon Sep 17 00:00:00 2001 From: blankie Date: Sat, 2 Dec 2023 10:58:23 +1100 Subject: [PATCH] Fix viewing polls with no voters_count key https://estrogen.network/@froggo/9igjsqqhxhsgtu4q --- models.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;