Skip to content

Commit

Permalink
IcingaHostForm: Fix crashing of form for invalid check command
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Dec 10, 2024
1 parent 4032d49 commit 1d19d40
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion application/forms/IcingaHostForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Icinga\Module\Director\Forms;

use Exception;
use Icinga\Exception\AuthenticationException;
use Icinga\Module\Director\Auth\Permission;
use Icinga\Module\Director\Auth\Restriction;
Expand Down Expand Up @@ -83,7 +84,13 @@ protected function addClusteringElements()
'class' => 'autosubmit',
]);

if ($this->getSentOrResolvedObjectValue('has_agent') === 'y') {
try {
$hasAgent = $this->getSentOrResolvedObjectValue('has_agent') === 'y';
} catch (Exception $e) {
$hasAgent = false;
}

if ($hasAgent) {
$this->addBoolean('master_should_connect', [
'label' => $this->translate('Establish connection'),
'description' => $this->translate(
Expand Down

0 comments on commit 1d19d40

Please sign in to comment.