Avoid null pointer exception

This commit is contained in:
Björn Fromme
2020-11-17 11:59:25 +01:00
parent 4c34c691f5
commit cb825dc0ed
@@ -87,8 +87,8 @@ class MapController extends ActionController
foreach ($products as $product) foreach ($products as $product)
{ {
/** @var \EP\EpProducts\Domain\Model\Product $product */ /** @var \EP\EpProducts\Domain\Model\Product $product */
$hotel = reset($product->getHotels()->toArray()); $hotel = $product->getHotels()->current();
if (!$hotel->isShowAsTeaser()) { if (null === $hotel || false === $hotel->isShowAsTeaser()) {
continue; continue;
} }
$markerData[] = [ $markerData[] = [