Skip to content

Commit

Permalink
Merge pull request ppy#11694 from nanaya/score-check
Browse files Browse the repository at this point in the history
Update total score check
  • Loading branch information
peppy authored Dec 4, 2024
2 parents 6508849 + 3ce1e3b commit d277c9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/Models/Solo/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ public function assertCompleted(): void
throw new InvariantException('Invalid accuracy.');
}

// unsigned int (as per the column)
if ($this->total_score === null || $this->total_score < 0 || $this->total_score > 4294967295) {
// int (as per es schema)
if ($this->total_score === null || $this->total_score < 0 || $this->total_score > 2147483647) {
throw new InvariantException('Invalid total_score.');
}

// unsigned int (no data type enforcement as this goes into the json, but just to match total_score)
// int (no data type enforcement as this goes into the json, but just to match total_score)
if (
$this->data->totalScoreWithoutMods !== null
&& ($this->data->totalScoreWithoutMods < 0 || $this->data->totalScoreWithoutMods > 4294967295)
&& ($this->data->totalScoreWithoutMods < 0 || $this->data->totalScoreWithoutMods > 2147483647)
) {
throw new InvariantException('Invalid total_score_without_mods.');
}
Expand Down

0 comments on commit d277c9a

Please sign in to comment.