Skip to content

Commit

Permalink
Fix null pointer exception possibility
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Dec 6, 2023
1 parent 044203e commit 221b79b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Form/Extension/AddToCartTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ public function reworkFormForGiftCard(FormEvent $event): void
return;
}

$variant = $data->getCartItem()->getVariant();
if (null === $variant) {
return;
}

/** @var ProductInterface|null $product */
$product = $data->getCartItem()->getProduct();
$product = $variant->getProduct();
if (null === $product) {
return;
}
Expand Down

0 comments on commit 221b79b

Please sign in to comment.