Skip to content

Commit

Permalink
fix: check if latest delivery exists before trying to get it's id (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
René Hrdina committed Sep 6, 2023
1 parent 0d0fc0d commit fe71190
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Core/Api/Transaction/Service/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ private function holdDelivery(string $orderId, Context $context)
*/
$orderEntity = $this->getOrderEntity($orderId, $context);
$orderDeliveryStateHandler = $this->container->get(OrderDeliveryStateHandler::class);
$orderDeliveryStateHandler->hold($orderEntity->getDeliveries()->last()->getId(), $context);
if (null !== $orderEntity->getDeliveries()->last()) {
$orderDeliveryStateHandler->hold($orderEntity->getDeliveries()->last()->getId(), $context);
}
} catch (\Exception $exception) {
$this->logger->critical($exception->getTraceAsString());
}
Expand Down

0 comments on commit fe71190

Please sign in to comment.