From ee7b8f1856a39660a11b2d0afad0b061df121fac Mon Sep 17 00:00:00 2001 From: AlexBVolcy <74930484+AlexBVolcy@users.noreply.github.com> Date: Wed, 10 May 2023 13:44:07 -0700 Subject: [PATCH] Get Bid Type For Adjustments Bug Fix (#2767) --- exchange/bidder.go | 2 +- exchange/bidder_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/exchange/bidder.go b/exchange/bidder.go index e355c18ced1..f5efcff3edd 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -699,7 +699,7 @@ func getBidTypeForAdjustments(bidType openrtb_ext.BidType, impID string, imp []o if bidType == openrtb_ext.BidTypeVideo { for _, imp := range imp { if imp.ID == impID { - if imp.Video.Plcmt == adcom1.VideoPlcmtAccompanyingContent { + if imp.Video != nil && imp.Video.Plcmt == adcom1.VideoPlcmtAccompanyingContent { return "video-outstream" } break diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index 3bd023dd859..4e94a18f324 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -3036,6 +3036,17 @@ func TestGetBidType(t *testing.T) { givenImpId: "imp-id", expected: string(openrtb_ext.BidTypeBanner), }, + { + name: "VideoBidTypeImpVideoIsNil", + givenImp: []openrtb2.Imp{ + { + ID: "imp-id", + }, + }, + givenBidType: openrtb_ext.BidTypeVideo, + givenImpId: "imp-id", + expected: "video-instream", + }, } for _, test := range testCases {