Avoid null-pointer exception
This commit is contained in:
@@ -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,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user