Avoid null-pointer exception

This commit is contained in:
Björn Fromme
2018-09-22 10:45:20 +02:00
parent 72a0099cc4
commit cc7138bbb7
@@ -84,13 +84,15 @@ class HotelController extends ActionController
*/
public function detailAction(Hotel $hotel = null)
{
if ($hotel === null) {
if ($hotel !== null) {
$hotelUid = $hotel->getUid();
} else {
$hotelUid = $this->settings['hotelUid'];
/** @var Hotel $hotel */
$hotel = $this->hotelRepository->findByIdentifier($hotelUid);
}
$filterSettings = new FilterSettings();
$filterSettings->setHotelUid($hotel->getUid());
$filterSettings->setHotelUid($hotelUid);
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
$limit = $this->settings['showMoreLink'] ? 4 : 0;
$teasers = $this->productService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);