diff --git a/internal/ym/products/repository_api.go b/internal/ym/products/repository_api.go index 9067ed0..21c1199 100644 --- a/internal/ym/products/repository_api.go +++ b/internal/ym/products/repository_api.go @@ -185,12 +185,15 @@ func (r *apiRepository) processOfferMappings(offerMappings []ymclient.GetOfferMa protoOffer := r.converter.YmOfferToProtoOffer(offerMapping.Offer) if protoOffer == nil { fmt.Printf("Warning: received nil offer for ID %s\n", offerMapping.Offer.OfferId) - resultOffers = append(resultOffers, &pb.GetProductsResponse_Offer{}) continue } - protoOffer.MarketCategoryId = *offerMapping.Mapping.MarketCategoryId - + if mapping, ok := offerMapping.GetMappingOk(); ok { + if marketCategoryId, ok := mapping.GetMarketCategoryIdOk(); ok { + protoOffer.MarketCategoryId = *marketCategoryId + } + } resultOffers = append(resultOffers, protoOffer) + } return resultOffers, nil