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 5, 2023
1 parent 0d0fc0d commit 3cfedba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Core/Api/Transaction/Service/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ private function holdDelivery(string $orderId, Context $context)
*/
$orderEntity = $this->getOrderEntity($orderId, $context);
$orderDeliveryStateHandler = $this->container->get(OrderDeliveryStateHandler::class);
if (null !== $orderEntity->getDeliveries()->last()) {
$orderDeliveryStateHandler->hold($orderEntity->getDeliveries()->last()->getId(), $context);
}
$orderDeliveryStateHandler->hold($orderEntity->getDeliveries()->last()->getId(), $context);
} catch (\Exception $exception) {
$this->logger->critical($exception->getTraceAsString());
Expand Down

0 comments on commit 3cfedba

Please sign in to comment.