Avoid null-pointer exception

This commit is contained in:
Björn Fromme
2022-03-08 17:47:50 +01:00
parent 77e2e7690b
commit 3298885ef0
2 changed files with 19 additions and 10 deletions
@@ -92,9 +92,16 @@ class ProductViewHelper extends AbstractViewHelper
} else {
/** @var ContentObjectRenderer $contentObject */
$contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
if (is_array($product)) {
$param = $product['detailPage'];
} elseif (null !== $product) {
$param = $product->getUid();
} else {
$param = null;
}
$uri = $contentObject->typoLink_URL(
[
'parameter' => is_array($product) ? $product['detailPage'] : $product->getUid(),
'parameter' => $param,
]
);
}