Fix nil pointer dereference in ToOCSS when Price.Type is nil
Build and Push Docker Image / build_and_push (push) Failing after 2m57s
Details
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:
parent
51068be38b
commit
feb4909a70
|
@ -200,11 +200,13 @@ func (b *CarpoolServiceBooking) ToOCSS() ocss.Booking {
|
|||
}
|
||||
if b.Price != nil {
|
||||
pricetype := ocss.Unknown
|
||||
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,
|
||||
Amount: b.Price.Amount,
|
||||
|
|
Loading…
Reference in New Issue