Fix nil pointer dereference in ToOCSS when Price.Type is nil
Build and Push Docker Image / build_and_push (push) Failing after 2m57s Details

Handle optional Price.Type field properly to prevent panic when converting booking to OCSS format.
This commit is contained in:
Arnaud Delcasse 2025-10-08 15:59:31 +02:00
parent 51068be38b
commit feb4909a70
1 changed files with 6 additions and 4 deletions

View File

@ -200,10 +200,12 @@ func (b *CarpoolServiceBooking) ToOCSS() ocss.Booking {
}
if b.Price != nil {
pricetype := ocss.Unknown
if *b.Price.Type == CarpoolServicePriceType_FREE {
pricetype = ocss.Free
} else if *b.Price.Type == CarpoolServicePriceType_PAYING {
pricetype = ocss.Paying
if b.Price.Type != nil {
if *b.Price.Type == CarpoolServicePriceType_FREE {
pricetype = ocss.Free
} else if *b.Price.Type == CarpoolServicePriceType_PAYING {
pricetype = ocss.Paying
}
}
price = ocss.Price{
Type: &pricetype,