Skip to content

Commit

Permalink
Check if contestProblems collection is empty
Browse files Browse the repository at this point in the history
Before we would get a `false` as there is no first and fail on:
$iniData = [
	'color' => $contestProblem?->getColor(),
];

as we have a boolean, not a null.
  • Loading branch information
vmcj committed Nov 6, 2023
1 parent 2caea0b commit 704bd4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webapp/src/Controller/Jury/ProblemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function exportAction(int $problemId): StreamedResponse
->getOneOrNullResult();

/** @var ContestProblem|null $contestProblem */
$contestProblem = $problem->getContestProblems()->first();
$contestProblem = $problem->getContestProblems()->first() ?: null;

// Build up INI data.
$iniData = [
Expand Down

0 comments on commit 704bd4c

Please sign in to comment.