I'm seeing the following error log in New Relic. This error logs very rarely, and comes from adding a product to the cart:
TypeError: Uncaught exception 'TypeError' with message 'Argument 1 passed to Magento\Catalog\Block\Product\ImageBuilder::setProduct() must be an instance of Magento\Catalog\Model\Product, null given, called in /srv/public_html/vendor/author/name/Block/Confirm.php on line 417' in /srv/public_html/vendor/magento/module-catalog/Block/Product/ImageBuilder.php:55
I'm not sure why this error is logging, this is the block of code in question (Confirm.php, Lines 415 - 421):
public function getImage($product, $imageId, $attributes = [])
{
return $this->imageBuilder->setProduct($product)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
Does anyone see anything out of the ordinary here, that would cause such an error?
Cheers, Max
if (!$product instanceof Magento\Catalog\Model\Product) { return false; }