Skip to content

Commit

Permalink
[BUGFIX] Avoid exception when accessing uninitialized settings (#50)
Browse files Browse the repository at this point in the history
Fixes: #49
Releases: master, 9.1, 9.0, 8.7, 7.6
  • Loading branch information
benjaminkott committed Apr 28, 2019
1 parent 53046b4 commit 13508ba
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Classes/Controller/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use T3G\AgencyPack\Blog\Service\CacheService;
use T3G\AgencyPack\Blog\Service\MetaService;
use T3G\AgencyPack\Blog\Utility\ArchiveUtility;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
Expand Down Expand Up @@ -149,8 +148,7 @@ protected function initializeView(ViewInterface $view): void
*/
public function listRecentPostsAction(): void
{
$maximumItems = (int)ArrayUtility::getValueByPath($this->settings, 'lists.posts.maximumDisplayedItems', '.') ?: 0;

$maximumItems = (int) ($this->settings['lists']['posts']['maximumDisplayedItems'] ?? 0);
$posts = (0 === $maximumItems)
? $this->postRepository->findAll()
: $this->postRepository->findAllWithLimit($maximumItems);
Expand Down

0 comments on commit 13508ba

Please sign in to comment.