Skip to content

Commit

Permalink
Do not crash when viewing an internal error for a deleted judgehost.
Browse files Browse the repository at this point in the history
Fixes #1809.
  • Loading branch information
nickygerritsen committed Oct 21, 2023
1 parent d55e720 commit 7060197
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion webapp/src/Controller/Jury/InternalErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ public function viewAction(int $errorId): Response
case 'judgehost':
// Judgehosts get disabled by their hostname, so we need to look it up here.
$judgehost = $this->em->getRepository(Judgehost::class)->findOneBy(['hostname' => $disabled['hostname']]);
$affectedLink = $this->generateUrl('jury_judgehost', ['judgehostid' => $judgehost->getJudgehostid()]);
$affectedText = $disabled['hostname'];
if ($judgehost) {
$affectedLink = $this->generateUrl('jury_judgehost', ['judgehostid' => $judgehost->getJudgehostid()]);
} else {
$affectedText .= ' (deleted)';
}
break;
case 'language':
$affectedLink = $this->generateUrl('jury_language', ['langId' => $disabled['langid']]);
Expand Down
8 changes: 7 additions & 1 deletion webapp/templates/jury/internal_error.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@
{% if affectedText is not null %}
<tr>
<th>Affected {{ internalError.disabled.kind }}</th>
<td><a href="{{ affectedLink }}">{{ affectedText }}</a></td>
<td>
{% if affectedLink %}
<a href="{{ affectedLink }}">{{ affectedText }}</a>
{% else %}
{{ affectedText }}
{% endif %}
</td>
</tr>
{% endif %}
<tr>
Expand Down

0 comments on commit 7060197

Please sign in to comment.