Skip to content

Commit 58dbfca

Browse files
nickygerritsenvmcj
authored andcommitted
Do not crash when viewing an internal error for a deleted judgehost.
Fixes #1809. (cherry picked from commit 7060197)
1 parent 5d1d97d commit 58dbfca

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

webapp/src/Controller/Jury/InternalErrorController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ public function viewAction(int $errorId): Response
117117
case 'judgehost':
118118
// Judgehosts get disabled by their hostname, so we need to look it up here.
119119
$judgehost = $this->em->getRepository(Judgehost::class)->findOneBy(['hostname' => $disabled['hostname']]);
120-
$affectedLink = $this->generateUrl('jury_judgehost', ['judgehostid' => $judgehost->getJudgehostid()]);
121120
$affectedText = $disabled['hostname'];
121+
if ($judgehost) {
122+
$affectedLink = $this->generateUrl('jury_judgehost', ['judgehostid' => $judgehost->getJudgehostid()]);
123+
} else {
124+
$affectedText .= ' (deleted)';
125+
}
122126
break;
123127
case 'language':
124128
$affectedLink = $this->generateUrl('jury_language', ['langId' => $disabled['langid']]);

webapp/templates/jury/internal_error.html.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@
7272
{% if affectedText is not null %}
7373
<tr>
7474
<th>Affected {{ internalError.disabled.kind }}</th>
75-
<td><a href="{{ affectedLink }}">{{ affectedText }}</a></td>
75+
<td>
76+
{% if affectedLink %}
77+
<a href="{{ affectedLink }}">{{ affectedText }}</a>
78+
{% else %}
79+
{{ affectedText }}
80+
{% endif %}
81+
</td>
7682
</tr>
7783
{% endif %}
7884
<tr>

0 commit comments

Comments
 (0)