Skip to content

Commit

Permalink
Fix index issue (prebid#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peiling-Ding authored May 14, 2024
1 parent 6dce8bc commit 31f08e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/modules/ad_cache/module/ranking.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func findWinnerFromResponseAndCache(

var winnerSeatBid openrtb2.SeatBid

if indexMaxInResp > 0 && seatMaxInCache != "" {
if indexMaxInResp >= 0 && seatMaxInCache != "" {
if bidResponse.SeatBid[indexMaxInResp].Bid[0].Price > cachedAds[seatMaxInCache].Bid.Price {
winnerSeatBid = bidResponse.SeatBid[indexMaxInResp]
addNewBidToCache(cachedAds, bidResponse, indexMaxInResp, config, placementId)
Expand All @@ -147,7 +147,7 @@ func findWinnerFromResponseAndCache(
delete(cachedAds, seatMaxInCache)
addNewBidToCache(cachedAds, bidResponse, -1, config, placementId)
}
} else if indexMaxInResp > 0 {
} else if indexMaxInResp >= 0 {
winnerSeatBid = bidResponse.SeatBid[indexMaxInResp]
addNewBidToCache(cachedAds, bidResponse, indexMaxInResp, config, placementId)
} else if seatMaxInCache != "" {
Expand Down

0 comments on commit 31f08e2

Please sign in to comment.