Skip to content

Commit 78e48af

Browse files
committed
Handle problemBadges for problems w/o explicit color gracefully.
1 parent 8ed16f5 commit 78e48af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ public function fileTypeIcon(string $type): string
11471147
public function problemBadge(ContestProblem $problem, bool $grayedOut = false): string
11481148
{
11491149
$rgb = Utils::convertToHex($problem->getColor() ?? '#ffffff');
1150-
if ($grayedOut) {
1150+
if ($grayedOut || empty($rgb)) {
11511151
$rgb = Utils::convertToHex('whitesmoke');
11521152
}
11531153
$background = Utils::parseHexColor($rgb);
@@ -1177,7 +1177,7 @@ public function problemBadge(ContestProblem $problem, bool $grayedOut = false):
11771177
public function problemBadgeMaybe(ContestProblem $problem, ScoreboardMatrixItem $matrixItem): string
11781178
{
11791179
$rgb = Utils::convertToHex($problem->getColor() ?? '#ffffff');
1180-
if (!$matrixItem->isCorrect) {
1180+
if (!$matrixItem->isCorrect || empty($rgb)) {
11811181
$rgb = Utils::convertToHex('whitesmoke');
11821182
}
11831183
$background = Utils::parseHexColor($rgb);

0 commit comments

Comments
 (0)