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,10 +200,12 @@ func (b *CarpoolServiceBooking) ToOCSS() ocss.Booking {
|
||||||
}
|
}
|
||||||
if b.Price != nil {
|
if b.Price != nil {
|
||||||
pricetype := ocss.Unknown
|
pricetype := ocss.Unknown
|
||||||
if *b.Price.Type == CarpoolServicePriceType_FREE {
|
if b.Price.Type != nil {
|
||||||
pricetype = ocss.Free
|
if *b.Price.Type == CarpoolServicePriceType_FREE {
|
||||||
} else if *b.Price.Type == CarpoolServicePriceType_PAYING {
|
pricetype = ocss.Free
|
||||||
pricetype = ocss.Paying
|
} else if *b.Price.Type == CarpoolServicePriceType_PAYING {
|
||||||
|
pricetype = ocss.Paying
|
||||||
|
}
|
||||||
}
|
}
|
||||||
price = ocss.Price{
|
price = ocss.Price{
|
||||||
Type: &pricetype,
|
Type: &pricetype,
|
||||||
|
|
Loading…
Reference in New Issue