[backend/federation] Don't allow negative voter counts

This commit is contained in:
Laura Hausmann 2024-10-23 04:49:09 +02:00
parent bb276c57f3
commit c55e673cd2
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -1009,6 +1009,8 @@ public class NoteService(
if (choices.Count == 0) if (choices.Count == 0)
throw GracefulException.UnprocessableEntity("Poll must have at least one option"); throw GracefulException.UnprocessableEntity("Poll must have at least one option");
if (question.VotersCount is < 0)
throw GracefulException.UnprocessableEntity("Voters count must not be negative");
poll = new Poll poll = new Poll
{ {