Skip to content

Commit

Permalink
[BUGFIX] harden error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Strobach <[email protected]>
  • Loading branch information
kaystrobach committed Oct 25, 2022
1 parent d00bed7 commit d7afe78
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Classes/Domain/Model/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Core\TypoScript\TemplateService;
use TYPO3\CMS\Form\Mvc\Configuration\Exception\ParseErrorException;
use TYPO3\CMS\Form\Mvc\Configuration\YamlSource;

/**
Expand Down Expand Up @@ -78,8 +79,13 @@ public function __construct($extensionName)
}
$yamlFile = ExtensionManagementUtility::extPath($this->getExtensionName()) . 'Meta/theme.yaml';
if (file_exists($yamlFile)) {
$yamlSource = GeneralUtility::makeInstance(YamlSource::class);
$this->metaInformation = $yamlSource->load(array($yamlFile));
try {
$yamlSource = GeneralUtility::makeInstance(YamlSource::class);
$this->metaInformation = $yamlSource->load(array($yamlFile));
} catch (ParseErrorException $exception) {
$this->metaInformation = [];
}

} else {
throw new \Exception('No Yaml meta information found!');
}
Expand Down

0 comments on commit d7afe78

Please sign in to comment.