KickstartForm: do not fail on missing element

This commit is contained in:
Thomas Gelf 2019-02-14 15:34:51 +01:00
parent 56293f167f
commit dc48a7e6a0
1 changed files with 5 additions and 2 deletions

View File

@ -199,8 +199,11 @@ class KickstartForm extends DirectorForm
if (! isset($resourceConfig->charset)
|| ! in_array($resourceConfig->charset, array('utf8', 'utf8mb4'))
) {
$this->getElement('resource')
->addError('Please change the encoding for the director database to utf8');
if ($resource = $this->getElement('resource')) {
$resource->addError('Please change the encoding for the director database to utf8');
} else {
$this->addError('Please change the encoding for the director database to utf8');
}
}
$resource = $this->getResource();