From 1e5fe23159df75a630252333987f22ea9bcc4ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 6 Nov 2025 15:32:39 +0100 Subject: [PATCH] fix: don't rely on individual prices being available for all participants --- src/BusProNet/Model/Booking.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BusProNet/Model/Booking.php b/src/BusProNet/Model/Booking.php index 3f908e0..a9ea3dd 100644 --- a/src/BusProNet/Model/Booking.php +++ b/src/BusProNet/Model/Booking.php @@ -249,7 +249,7 @@ class Booking foreach ([...$this->transportationServices, ...$this->additionalServices] as $service) { if ((in_array($participantIndex, $service->mapping) || true === $service->mandatory) && isset($service->individualPrice[$participantIndex])) { - $price += $service->individualPrice[$participantIndex]; + $price += $service->individualPrice[$participantIndex] ?? 0; } } @@ -257,13 +257,13 @@ class Booking foreach ($this->surcharges as $surcharge) { if (in_array($participantIndex, $surcharge->mapping) && isset($surcharge->individualPrice[$participantIndex])) { - $price += $surcharge->individualPrice[$participantIndex]; + $price += $surcharge->individualPrice[$participantIndex] ?? 0; } } $room = $this->getRoomForParticipant($participantIndex); if (null !== $room && isset($room->individualPrice[$participantIndex])) { - $price += $room->individualPrice[$participantIndex]; + $price += $room->individualPrice[$participantIndex] ?? 0; } return $price;