[backend/federation] Don't allow negative voter counts
This commit is contained in:
parent
bb276c57f3
commit
c55e673cd2
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue