Skip to content

Commit 279e655

Browse files
committed
Fix clarifications for unlinked problems
Closes: #3032
1 parent 2873500 commit 279e655

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

webapp/src/Controller/Jury/ClarificationController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ public function viewAction(Request $request, int $id): Response
193193
$clarcontest = $contest->getShortname();
194194
$data['subjectlink'] = null;
195195
if ($clar->getProblem()) {
196-
$concernssubject = $contest->getCid() . "-" . $clar->getProblem()->getProbid();
196+
if ($clar->getContestProblem()) {
197+
$concernssubject = $contest->getCid() . "-" . $clar->getProblem()->getProbid();
198+
} else {
199+
// Very special case, this problem is unlinked.
200+
$concernssubject = "";
201+
}
197202
$data['subjectlink'] = $this->generateUrl('jury_problem', ['probId' => $clar->getProblem()->getProbid()]);
198203
} elseif ($clar->getCategory()) {
199204
$concernssubject = $contest->getCid() . "-" . $clar->getCategory();

webapp/src/Twig/TwigExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,9 @@ public function fileTypeIcon(string $type): string
11791179
return 'fas fa-file-' . $iconName;
11801180
}
11811181

1182-
public function problemBadge(ContestProblem $problem, bool $grayedOut = false): string
1182+
public function problemBadge(?ContestProblem $problem, bool $grayedOut = false): string
11831183
{
1184-
$rgb = Utils::convertToHex($problem->getColor() ?? '#ffffff');
1184+
$rgb = Utils::convertToHex($problem?->getColor() ?? '#ffffff');
11851185
if ($grayedOut || empty($rgb)) {
11861186
$rgb = Utils::convertToHex('whitesmoke');
11871187
}
@@ -1197,7 +1197,7 @@ public function problemBadge(ContestProblem $problem, bool $grayedOut = false):
11971197
$rgb,
11981198
$border,
11991199
$foreground,
1200-
$problem->getShortname()
1200+
$problem?->getShortname() ?? '?'
12011201
);
12021202
}
12031203

0 commit comments

Comments
 (0)