From 2f78ddb8ade5a9f7b31fb3ec9b5fd6e0356ad3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 6 Nov 2025 15:24:51 +0100 Subject: [PATCH] fix: don't rely on individual prices being available for all participants --- src/BusProNet/Model/Booking.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/BusProNet/Model/Booking.php b/src/BusProNet/Model/Booking.php index 15ae6eb..233bdff 100644 --- a/src/BusProNet/Model/Booking.php +++ b/src/BusProNet/Model/Booking.php @@ -110,19 +110,20 @@ class Booking // Sum up all services foreach ([...$this->transportationServices, ...$this->additionalServices] as $service) { if (in_array($participantIndex, $service->mapping) || true === $service->mandatory) { - $price += $service->individualPrice[$participantIndex]; + $price += $service->individualPrice[$participantIndex] ?? 0; } } // Sum up all surcharges foreach ($this->surcharges as $surcharge) { if (in_array($participantIndex, $surcharge->mapping)) { - $price += $surcharge->individualPrice[$participantIndex]; + $price += $surcharge->individualPrice[$participantIndex] ?? 0; } } - $room = $this->getRoomForParticipant($participantIndex); - $price += $room->individualPrice[$participantIndex]; + if (null !== $room = $this->getRoomForParticipant($participantIndex)) { + $price += $room->individualPrice[$participantIndex] ?? 0; + } return $price; }